Fix restartLanguageServer command not found in command palette (#22045)#25996
Fix restartLanguageServer command not found in command palette (#22045)#25996arymaheshwari wants to merge 2 commits 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
|
@microsoft-github-policy-service agree |
|
@rchiodo @bschnurr @StellaHuang95 could I get a review of this to confirm this is the desired behavior for this interaction |
|
The implementation appears to support Pylance through |
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)