fix(language-service): Remove 'context' used for module resolution (#32015)
The language service relies on a "context" file that is used as the canonical "containing file" when performing module resolution. This file is unnecessary since the language service host's current directory always default to the location of tsconfig.json for the project, which would give the correct result. This refactoring allows us to simplify the "typescript host" and also removes the need for custom logic to find tsconfig.json. PR Close #32015
This commit is contained in:

committed by
Kara Erickson

parent
a95f860a96
commit
a91ab15525
@ -7,12 +7,10 @@
|
||||
*/
|
||||
|
||||
import {StaticSymbol} from '@angular/compiler';
|
||||
import {CompilerHost} from '@angular/compiler-cli';
|
||||
import {ReflectorHost} from '@angular/language-service/src/reflector_host';
|
||||
import * as ts from 'typescript';
|
||||
|
||||
import {getExpressionDiagnostics, getTemplateExpressionDiagnostics} from '../../src/diagnostics/expression_diagnostics';
|
||||
import {CompilerOptions} from '../../src/transformers/api';
|
||||
import {getTemplateExpressionDiagnostics} from '../../src/diagnostics/expression_diagnostics';
|
||||
import {Directory} from '../mocks';
|
||||
|
||||
import {DiagnosticContext, MockLanguageServiceHost, getDiagnosticTemplateInfo} from './mocks';
|
||||
@ -31,10 +29,7 @@ describe('expression diagnostics', () => {
|
||||
service = ts.createLanguageService(host, registry);
|
||||
const program = service.getProgram() !;
|
||||
const checker = program.getTypeChecker();
|
||||
const options: CompilerOptions = Object.create(host.getCompilationSettings());
|
||||
options.genDir = '/dist';
|
||||
options.basePath = '/src';
|
||||
const symbolResolverHost = new ReflectorHost(() => program !, host, options);
|
||||
const symbolResolverHost = new ReflectorHost(() => program !, host);
|
||||
context = new DiagnosticContext(service, program !, checker, symbolResolverHost);
|
||||
type = context.getStaticSymbol('app/app.component.ts', 'AppComponent');
|
||||
});
|
||||
|
Reference in New Issue
Block a user