Skip to content

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

@github-project-automation github-project-automation bot moved this to Not started in PR Backlog Feb 27, 2025
@mlgq mlgq changed the title Fix incorrect plugin enable timing (#61302) Fix incorrect plugin enable timing Feb 27, 2025
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.

Copy link
Author

@mlgq mlgq Mar 10, 2025

Choose a reason for hiding this comment

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

Hi @RyanCavanaugh ,just wanted to check if there’s anything I can do to help move this PR forward. Thanks for your time!

@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
@RyanCavanaugh
Copy link
Member

Given the short future of language service plugins in this particular architecture going forward, and the risk of breaking other plugins, I don't think we want to mess with this. This code is basically untestable (we have no idea what plugins in the wild are doing) and clearly works well enough for the plugins that are already out there.

@mlgq
Copy link
Author

mlgq commented Mar 29, 2025

okay, understand. It can be resolved temporarily through proxy for now.

@sandersn sandersn removed this from PR Backlog Apr 22, 2025
@microsoft microsoft locked as resolved and limited conversation to collaborators Oct 15, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

using projectService.setHostConfiguration in a plugin is invalid

3 participants