Skip to content

Add a command to restart the language server #22045

Open

Description

@Saltsmart

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.

Activity

  1. debonte commented on Aug 25, 2023

    @debonte

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

    image

  2. stevesimmons commented on Aug 25, 2023

    @stevesimmons

    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.

  3. Saltsmart commented on Aug 26, 2023

    @Saltsmart
    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
    
  4. debonte commented on Aug 26, 2023

    @debonte

    Don Jayamanne (@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

  5. DonJayamanne commented on Aug 28, 2023

    @DonJayamanne

    I think Matt Bierner (@mjbvz) would be the best person to answer this .

  6. added
    bugIssue identified by VS Code Team member as probable bug
    needs PRReady to be worked on
    and removed
    triage-neededNeeds assignment to the proper sub-team
    on Sep 25, 2023
  7. alexmerm commented on Oct 19, 2023

    @alexmerm

    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
    
  8. ferstlf commented on Feb 28, 2024

    @ferstlf

    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.

  9. zanuka commented on Mar 21, 2025

    @zanuka

    Don Jayamanne (@DonJayamanne) I'd be happy to work on this

  10. Hassan9255 commented on Jul 25, 2025

    @Hassan9255

    can i work on this

  11. yahiagaming495 commented on Sep 15, 2025

    @yahiagaming495

    Can i try to work on this? (No guarantee i will be able to fix it)

  12. arymaheshwari commented on Jun 4, 2026

    @arymaheshwari

    Hi, I would love to work on this issue. Will raise a PR!

  13. Tejasvi6603 commented on Aug 20, 2026

    @Tejasvi6603

    Hi! I’m interested in working on this issue.
    Could you please assign it to me? Thanks!

  14. wabain commented on Oct 13, 2026

    @wabain

    I hit another variation of this. I did have a Python file open, but it was in a split pane and the other pane happened to have focus. Since "Restart Language Server" doesn't operate on a single file, I wouldn't have expected the focus to matter. I had to find and look at the extension's manifest to work out what was missing.

    I think #22045 (comment) is right about this being an inconsistency between commands and the fix being to remove the editorLangId condition. That condition has now been widened to (editorLangId == python || notebookType == jupyter-notebook) in #23737, but that still doesn't address the general case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue identified by VS Code Team member as probable buggood first issueneeds PRReady to be worked on

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions