-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Disable reloading when changing language servers #18884
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
Disable reloading when changing language servers #18884
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code appears way simpler now 🥳 great work. I have some concerns around the support for multiroot scenario, especially for Jedi.
karrtikr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
| startLanguageServer( | ||
| languageServerType: LanguageServerType, | ||
| resource?: Resource, | ||
| ): Promise<ILanguageServerExtensionManager>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ): Promise<ILanguageServerExtensionManager>; | |
| ): Promise<void>; |
Given it's not used anywhere outside the class, do we want to expose methods of ILanguageServerExtensionManager outside? Something to think about.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A subset of ILanguageServerExtensionManager methods are exposed on purpose for the classes implementing this interface.
I'll add to the comment above the definition of ILanguageServerExtensionManager that these methods shouldn't be used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
classes implementing this interface.
I understand they're exposed for the LanguageServerWatcher which is the class implementing ILanguageServerWatcher, it's fine to expose it for internal use.
But I don't think we need to expose ILanguageServerExtensionManager for external use (code outside language servers), so returning void here should be sufficient.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will not address this for now, captured in #18946.
…thon#18884) * Remove LSFolderService dependency * No DI proof of concept * Add safeguard when connecting/disconnecting * Proper Pylance LS disposal * Fix Jedi LS startup/disposal * Add cache support * Remove DI decorators + registry activation * Do not reload window when Pylance not installed * jedi/pylance/none extension managers * languageServer/watcher.unit.test.ts * News entry * Add 2.7 behaviour + fix linting * Remove deprecated LS settings * Add support for 1 LS per workspace folder * Add tests * Update src/client/languageServer/watcher.ts Co-authored-by: Kartik Raj <[email protected]> * Add resource path to "starting ls" message * Fix issue with get() * Amend ILanguageServerExtensionManager comment Co-authored-by: Kartik Raj <[email protected]>
For #18509
Behaviour before this PR:
python.languageServersetting would trigger a prompt asking to reloadBehaviour in this PR:
LanguageServerWatcherLanguageServerExtensionActivationServiceILanguageServerExtensionManagerinterface for that specific language server, and then callILanguageServerExtensionManager.startLanguageServerILanguageServerExtensionManagerclasses replace the Jedi and Pylance activator classes, with some added functionality to start up and dispose of the language server classesNodeLanguageServerFolderServiceclass, which was a remnant from the old MPLS days. It had a few "convenience" functions that were doing way too much work to infer the LS version, when we can pick it up using the VS Code API.General architecture
classDiagram class ILanguageServerCapabilities { ILanguageServerProxy serverProxy Promise<ILanguageServer> get() } class ILanguageServerExtensionManager { Promise<void> startLanguageServer() void stopLanguageServer() boolean canStartLanguageServer() void languageServerNotAvailable() void dispose() } ILanguageServerCapabilities <|-- LanguageServerCapabilities ILanguageServerCapabilities <|-- ILanguageServerExtensionManager LanguageServerCapabilities <|-- JediLSExtensionManager LanguageServerCapabilities <|-- PylanceLSExtensionManager ILanguageServerExtensionManager <|-- NoneLSExtensionManager ILanguageServerExtensionManager <|-- JediLSExtensionManager ILanguageServerExtensionManager <|-- PylanceLSExtensionManager class JediLSExtensionManager{ } class PylanceLSExtensionManager { } class NoneLSExtensionManager { }Activation flow
flowchart TD id1["Extension load"]--->|Register watcher singleton|id2["Activate services"]--->|"watcher.startLanguageServer()"|id3["watcher.createLanguageServer(lsType)"]--->|"LS extension manager created"|id4["lsExtensionManager.startLanguageServer()"]