Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the issue where modifying extraFileExtensions through ProjectService.setHostConfiguration in the plugin has no effect. #61303

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mlgq
Copy link

@mlgq mlgq commented Feb 27, 2025

If the plugin is enabled before this.updateRootAndOptionsOfNonInferredProject and the project service host configuration is changed through projectService.setHostConfiguration in the plugin, enabling the plugin will result in a recursive call to loadConfiguredProject, then the outer loadConfiguredProject will finally call this.updateRootAndOptionsOfNonInferredProject with the parameters that before the plug-in was enabled.

Fixes #61302

@mlgq mlgq changed the title Fix incorrect plugin enable timing (#61302) Fix incorrect plugin enable timing Feb 27, 2025
@@ -2934,9 +2934,9 @@ export class ProjectService {
project.enableLanguageService();
this.watchWildcards(configFilename, configFileExistenceInfo, project);
}
project.enablePluginsWithOptions(compilerOptions);
const filesToAdd = parsedCommandLine.fileNames.concat(project.getExternalFiles(ProgramUpdateLevel.Full));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This move doesn't seem correct. Plugins can and do modify the results of getExternalFiles -- that API exists in the first place to support plugins.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right. I think we can add an attribute to Project to determine whether a plugin has modified extraFileExtensions, and use this to ensure that only the innermost recursive call to updateRootAndOptionsOfNonInferredProject is made.

@typescript-bot typescript-bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Feb 28, 2025
@mlgq
Copy link
Author

mlgq commented Feb 28, 2025

@microsoft-github-policy-service agree

@mlgq mlgq changed the title Fix incorrect plugin enable timing Fix the issue where modifying extraFileExtensions through ProjectService.setHostConfiguration in the plugin has no effect. Feb 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For Uncommitted Bug PR for untriaged, rejected, closed or missing bug
Projects
Status: Not started
Development

Successfully merging this pull request may close these issues.

using projectService.setHostConfiguration in a plugin is invalid
3 participants