Skip to content

Commit e4563c2

Browse files
committedFeb 28, 2025
Fix incorrect plugin enable timing
1 parent 6121f45 commit e4563c2

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed
 

‎src/server/editorServices.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -2935,8 +2935,10 @@ export class ProjectService {
29352935
this.watchWildcards(configFilename, configFileExistenceInfo, project);
29362936
}
29372937
project.enablePluginsWithOptions(compilerOptions);
2938-
const filesToAdd = parsedCommandLine.fileNames.concat(project.getExternalFiles(ProgramUpdateLevel.Full));
2939-
this.updateRootAndOptionsOfNonInferredProject(project, filesToAdd, fileNamePropertyReader, compilerOptions, parsedCommandLine.typeAcquisition!, parsedCommandLine.compileOnSave, parsedCommandLine.watchOptions);
2938+
if (!project.hasPluginSetExtraFileExtensions) {
2939+
const filesToAdd = parsedCommandLine.fileNames.concat(project.getExternalFiles(ProgramUpdateLevel.Full));
2940+
this.updateRootAndOptionsOfNonInferredProject(project, filesToAdd, fileNamePropertyReader, compilerOptions, parsedCommandLine.typeAcquisition!, parsedCommandLine.compileOnSave, parsedCommandLine.watchOptions);
2941+
}
29402942
tracing?.pop();
29412943
}
29422944

‎src/server/project.ts

+13
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,14 @@ export abstract class Project implements LanguageServiceHost, ModuleResolutionHo
375375
/** @internal */
376376
protected readonly plugins: PluginModuleWithName[] = [];
377377

378+
/**
379+
* Used to determine whether enabled plugins have modified extra file extensions through ProjectService.setHostConfiguration
380+
* See: https://github.com/microsoft/TypeScript/issues/61302
381+
*
382+
* @internal
383+
*/
384+
hasPluginSetExtraFileExtensions = false;
385+
378386
/**
379387
* This is map from files to unresolved imports in it
380388
* Maop does not contain entries for files that do not have unresolved imports
@@ -2147,6 +2155,11 @@ export abstract class Project implements LanguageServiceHost, ModuleResolutionHo
21472155
return;
21482156
}
21492157

2158+
if (this.plugins.some(p => p.name === configEntry.name)) {
2159+
this.hasPluginSetExtraFileExtensions = true;
2160+
return;
2161+
}
2162+
21502163
const info: PluginCreateInfo = {
21512164
config: configEntry,
21522165
project: this,

0 commit comments

Comments
 (0)
Failed to load comments.