pylance-release
pylance-release copied to clipboard
Command 'Python: Restart Language Server' resulted in an error (command 'python.analysis.restartLanguageServer' not found)
Issue Type: Bug
Behaviour
Expected vs. Actual
Expected Behavior:
Python: Restart Language Server
Command working on startup after opening vscode with setting defaultInterpreterPath in .vscode/settings.json.
And after running Python: Select Interpreter as a workaround #13474 should not require running the command again when restarting vscode.
I expect setting defaultInterpreterPath to be enough that I don't need to select the interpreter every time I open vscode. In addition selecting the interpreter should presist on restarting vscode.
Actual Behavior:
Restart Language Server Command results in error: Command 'Python: Restart Language Server' resulted in an error (command 'python.analysis.restartLanguageServer' not found) on start up even when python.defaultInterpreterPath is set.
The Restart Language Server command only works after running the Python: Select Interpreter command. (Should not need to do this since I set the default)
After restarting vscode, Python: Restart Language Server results in command not found error.
Steps to reproduce:
https://user-images.githubusercontent.com/88350041/170557858-31a7cc63-8805-4111-98c5-7140541fa27d.mov
-
Open VSCode with workspace settings.json containing "python.languageServer": "Pylance", "python.analysis.typeCheckingMode": "basic", "python.defaultInterpreterPath": "/usr/local/bin/python3", ....
-
Cmd + Shift + P then Python: Restart Language Server
-
Error mentioned above
-
Cmd + Shift + P then Python: Select Interpreter
-
Select: 'Use Python from
python.defaultInterpreterPath
settings -
Restart Language Server Command Works
-
Restart VSCode
-
Cmd + Shift + P then Python: Restart Language Server results in same error mentioned above
Diagnostic data
- Python version (& distribution if applicable, e.g. Anaconda): 3.9.10
- Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Global
- Value of the
python.languageServer
setting: Pylance
Output for Python
in the Output
panel (View
→Output
, change the drop-down the upper-right of the Output
panel to Python
)
XXX
User Settings
languageServer: "Pylance"
Extension version: 2022.6.2 VS Code version: Code 1.67.2 (Universal) (c3511e6c69bb39013c4a4b7b9566ec1ca73fc4d5, 2022-05-17T18:20:57.384Z) OS version: Darwin x64 20.4.0 Restricted Mode: No
System Info
Item | Value |
---|---|
CPUs | Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz (16 x 2400) |
GPU Status | 2d_canvas: enabled canvas_oop_rasterization: disabled_off direct_rendering_display_compositor: disabled_off_ok gpu_compositing: enabled metal: disabled_off multiple_raster_threads: enabled_on oop_rasterization: enabled opengl: enabled_on rasterization: enabled raw_draw: disabled_off_ok skia_renderer: enabled_on video_decode: enabled video_encode: enabled webgl: enabled webgl2: enabled |
Load (avg) | 2, 2, 2 |
Memory (System) | 64.00GB (24.06GB free) |
Process Argv | . --crash-reporter-id 4e0b9a4e-90a4-4014-978a-f0882115f8e0 |
Screen Reader | no |
VM | 0% |
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
pythonvspyl392:30443607
pythontb:30283811
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
vscoreces:30445986
pythondataviewer:30285071
vscod805cf:30301675
pythonvspyt200:30340761
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593cf:30376535
vsc1dst:30438360
pythonvs932:30410667
wslgetstarted:30449410
pythonvsnew555:30457759
vscscmwlcmt:30465135
cppdebug:30492333
vsclangdc:30486549
we should register "Python: Restart Language Server" only when command handler is registered. but the fix should be in python core ext not in pylance.
@heejaechang any update on this investigation?
I can't seem to repro this behavior? as soon as I open py file, I see default interpreter is already selected?
please reopen if it still repro.