Skip to content

Add a command to restart the language server #22045

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

Open
Saltsmart opened this issue Aug 24, 2023 · 8 comments
Open

Add a command to restart the language server #22045

Saltsmart opened this issue Aug 24, 2023 · 8 comments
Labels
bug Issue identified by VS Code Team member as probable bug good first issue needs PR Ready to be worked on

Comments

@Saltsmart
Copy link

This has been discussed for vscode-python extension.
A command called restartLanguageServer has been created.

However this command can't be found in my command palette, maybe in pylance extension it's already deleted.
I'd like a way to re-analyse the code in a jupyter notebook, since the language server (or the extension) is always broken weirdly microsoft/pylance-release#4736.

@debonte
Copy link

debonte commented Aug 25, 2023

It's Python: Restart Language Server. Do you not see that in the command palette?

image

@stevesimmons
Copy link

I have similar problems with Pylance working for a while in a Jupyter notebook, then breaking.

It's Python: Restart Language Server. Do you not see that in the command palette?

For me, when the active VSC window is a Jupyter notebook, the command palette has Restart Language Server just for .Net, nothing for Python. Conversely, when the active VSC window is a Python file, the "Python: Restart Language Server" command does appear.

@Saltsmart
Copy link
Author

It's Python: Restart Language Server. Do you not see that in the command palette?

image

When the editor opens a .py file, this appears:

Snipaste_2023-08-26_09-57-22

However when in a jupyter notebook, this command vanishs:

Snipaste_2023-08-26_09-58-17

Here is my environment and extension info:

Version: 1.81.1 (system setup)
Commit: 6c3e3dba23e8fadc360aed75ce363ba185c49794
Date: 2023-08-09T22:22:42.175Z
Electron: 22.3.18
ElectronBuildId: 22689846
Chromium: 108.0.5359.215
Node.js: 16.17.1
V8: 10.8.168.25-electron.0
OS: Windows_NT x64 10.0.22000

Name: Python
Id: ms-python.python
Description: IntelliSense (Pylance), Linting, Debugging (multi-threaded, remote), code formatting, refactoring, unit tests, and more.
Version: 2023.14.0
Publisher: Microsoft
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=ms-python.python

Name: Pylance
Id: ms-python.vscode-pylance
Description: A performant, feature-rich language server for Python in VS Code
Version: 2023.8.40
Publisher: Microsoft
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=ms-python.vscode-pylance

Name: Jupyter Notebook Renderers
Id: ms-toolsai.jupyter-renderers
Description: Renderers for Jupyter Notebooks (with plotly, vega, gif, png, svg, jpeg and other such outputs)
Version: 1.0.17
Publisher: Microsoft
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter-renderers

Name: Jupyter
Id: ms-toolsai.jupyter
Description: Jupyter notebook support, interactive programming and computing that supports Intellisense, debugging and more.
Version: 2023.7.1002162226
Publisher: Microsoft
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter

Name: Flake8
Id: ms-python.flake8
Description: Linting support for python files using `flake8`.
Version: 2023.6.0
Publisher: Microsoft
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=ms-python.flake8

Name: Black Formatter
Id: ms-python.black-formatter
Description: Formatting support for python files using `black`.
Version: 2023.4.1
Publisher: Microsoft
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=ms-python.black-formatter

@debonte
Copy link

debonte commented Aug 26, 2023

@DonJayamanne, this reminds me that the language status {} button also doesn't show for notebooks. Maybe this should be solved in a general way for all languages rather than in a Python-specific way? Has this come up before?

image

@DonJayamanne
Copy link

I think @mjbvz would be the best person to answer this .

@debonte debonte transferred this issue from microsoft/pylance-release Sep 21, 2023
@debonte debonte assigned luabud and unassigned debonte Sep 21, 2023
@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Sep 21, 2023
@karthiknadig karthiknadig added bug Issue identified by VS Code Team member as probable bug good first issue needs PR Ready to be worked on and removed triage-needed Needs assignment to the proper sub-team labels Sep 25, 2023
@alexmerm
Copy link

Can confirm I have the same issue(works in python file, doesn't show up in jupyter file) for the following environment

Version: 1.82.2 (Universal)
Commit: abd2f3db4bdb28f9e95536dfa84d8479f1eb312d
Date: 2023-09-14T05:59:47.790Z
Electron: 25.8.1
ElectronBuildId: 23779380
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Darwin arm64 22.6.0

Name: Black Formatter
Id: ms-python.black-formatter
Description: Formatting support for Python files using `black`.
Version: 2023.4.1
Publisher: Microsoft
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=ms-python.black-formatter

Name: isort
Id: ms-python.isort
Description: Import Organization support for Python files using `isort`.
Version: 2023.10.1
Publisher: Microsoft
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=ms-python.isort

Name: Jupyter
Id: ms-toolsai.jupyter
Description: Jupyter notebook support, interactive programming and computing that supports Intellisense, debugging and more.
Version: 2023.8.1002501831
Publisher: Microsoft
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter

Name: Pylance
Id: ms-python.vscode-pylance
Description: A performant, feature-rich language server for Python in VS Code
Version: 2023.10.20
Publisher: Microsoft
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=ms-python.vscode-pylance

Name: Python
Id: ms-python.python
Description: IntelliSense (Pylance), Linting, Debugging (multi-threaded, remote), code formatting, refactoring, unit tests, and more.
Version: 2023.18.0
Publisher: Microsoft
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=ms-python.python

@ferstlf
Copy link

ferstlf commented Feb 28, 2024

Hi! Has there been any progress on this? We just ran into the same problem and it's quite annoying.

The "Python: Restart Language Server" command is listed in Python files but not in Jupyter notebooks. The "Python: Show Language Server Output" command, however, does show up in any file. So I'm wondering, would this just be a one-line change to remove the editorLangId == python in the when-condition of the restart command in package.json? To make it match the when-condition of the show-output command.

@zanuka
Copy link

zanuka commented Mar 21, 2025

@DonJayamanne I'd be happy to work on this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug good first issue needs PR Ready to be worked on
Projects
None yet
Development

No branches or pull requests

9 participants