feat(language-service): log Angular compiler options (#40364)
This commit records the Angular compiler options in the log file to help debugging. PR Close #40364
This commit is contained in:
parent
811cacc80c
commit
6a9e328432
|
@ -32,6 +32,7 @@ export class LanguageService {
|
|||
constructor(project: ts.server.Project, private readonly tsLS: ts.LanguageService) {
|
||||
this.parseConfigHost = new LSParseConfigHost(project.projectService.host);
|
||||
this.options = parseNgCompilerOptions(project, this.parseConfigHost);
|
||||
logCompilerOptions(project, this.options);
|
||||
this.strategy = createTypeCheckingProgramStrategy(project);
|
||||
this.adapter = new LanguageServiceAdapter(project);
|
||||
this.compilerFactory = new CompilerFactory(this.adapter, this.strategy, this.options);
|
||||
|
@ -185,11 +186,18 @@ export class LanguageService {
|
|||
project.log(`Config file changed: ${fileName}`);
|
||||
if (eventKind === ts.FileWatcherEventKind.Changed) {
|
||||
this.options = parseNgCompilerOptions(project, this.parseConfigHost);
|
||||
logCompilerOptions(project, this.options);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function logCompilerOptions(project: ts.server.Project, options: CompilerOptions) {
|
||||
const {logger} = project.projectService;
|
||||
const projectName = project.getProjectName();
|
||||
logger.info(`Angular compiler options for ${projectName}: ` + JSON.stringify(options, null, 2));
|
||||
}
|
||||
|
||||
function parseNgCompilerOptions(
|
||||
project: ts.server.Project, host: ConfigurationHost): CompilerOptions {
|
||||
if (!(project instanceof ts.server.ConfiguredProject)) {
|
||||
|
|
Loading…
Reference in New Issue