Skip to content

Commit

Permalink
Manually revert angular#55035
Browse files Browse the repository at this point in the history
  • Loading branch information
dylhunn committed May 22, 2024
1 parent afe4561 commit 6bcd8cf
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions packages/language-service/src/language_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,24 +53,21 @@ export class LanguageService {
private options: CompilerOptions;
readonly compilerFactory: CompilerFactory;
private readonly codeFixes: CodeFixes;
private readonly parseConfigHost: LSParseConfigHost;

constructor(
private readonly project: ts.server.Project,
private readonly tsLS: ts.LanguageService,
private readonly config: Omit<PluginConfig, 'angularOnly'>,
) {
if (project.projectKind === ts.server.ProjectKind.Configured) {
const parseConfigHost = new LSParseConfigHost(project.projectService.host);
this.options = parseNgCompilerOptions(project, parseConfigHost, config);
this.watchConfigFile(project, parseConfigHost);
} else {
this.options = project.getCompilerOptions();
}
this.parseConfigHost = new LSParseConfigHost(project.projectService.host);
this.options = parseNgCompilerOptions(project, this.parseConfigHost, config);
logCompilerOptions(project, this.options);

const programDriver = createProgramDriver(project);
const adapter = new LanguageServiceAdapter(project);
this.compilerFactory = new CompilerFactory(adapter, programDriver, this.options);
this.watchConfigFile(project);
this.codeFixes = new CodeFixes(tsLS, ALL_CODE_FIXES_METAS);
}

Expand Down Expand Up @@ -578,7 +575,7 @@ export class LanguageService {
});
}

private watchConfigFile(project: ts.server.Project, parseConfigHost: LSParseConfigHost) {
private watchConfigFile(project: ts.server.Project) {
// TODO: Check the case when the project is disposed. An InferredProject
// could be disposed when a tsconfig.json is added to the workspace,
// in which case it becomes a ConfiguredProject (or vice-versa).
Expand All @@ -592,7 +589,7 @@ export class LanguageService {
(fileName: string, eventKind: ts.FileWatcherEventKind) => {
project.log(`Config file changed: ${fileName}`);
if (eventKind === ts.FileWatcherEventKind.Changed) {
this.options = parseNgCompilerOptions(project, parseConfigHost, this.config);
this.options = parseNgCompilerOptions(project, this.parseConfigHost, this.config);
logCompilerOptions(project, this.options);
}
},
Expand Down

0 comments on commit 6bcd8cf

Please sign in to comment.