Fix restartLanguageServer command not found in command palette (#22045)#25996
Open
arymaheshwari wants to merge 1 commit into
Open
Fix restartLanguageServer command not found in command palette (#22045)#25996arymaheshwari wants to merge 1 commit into
arymaheshwari wants to merge 1 commit into
Conversation
…soft#22045) - Move python.analysis.restartLanguageServer command registration from individual language server managers to LanguageServerWatcher.register(), so it is always available regardless of which language server type is active - Fix async/forEach bug in restartLanguageServers() — forEach ignores returned Promises, so awaits inside were silently dropped; replaced with for...of - Fix resource URI reconstruction in restartLanguageServers() — map keys 'Pylance'/'None' are not URIs, Jedi keys are fsPath strings needing Uri.file() not Uri.parse() - Remove now-redundant static commandDispose and command registration from NodeLanguageServerManager and JediLanguageServerManager - Update unit tests: fix disposable count assertions, fix ICommandManager mocks, add test for restart command handler
Author
|
@microsoft-github-policy-service agree |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #22045
Problem
The
python.analysis.restartLanguageServercommand was previously owned by Pylance and was removed from it. The vscode-python extension registered the command handler inside individual manager constructors (NodeLanguageServerManager,JediLanguageServerManager), so it was only available when Pylance or Jedi was active — never whenLanguageServerType.Nonewas in use.Additionally,
LanguageServerWatcher.restartLanguageServers()had an async/forEach bug that silently discarded all awaits, and was never called from anywhere.Changes
watcher.ts: RegisterRestartLScommand inregister()so it is always active; fixrestartLanguageServers()withfor...ofand correct URI handlingnode/manager.ts: Remove staticcommandDisposeand command registration from constructorjedi/manager.ts: Same cleanupwatcher.unit.test.ts: Fix disposable count assertions, fixICommandManagermocks, add new test for restart command handlerTesting
All 24 language server watcher unit tests pass (
npm run test:unittests). Zero TypeScript errors (tsc --noEmit)