question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Extension switches back to Jedi when reloading after setting Pylance as the default language server

See original GitHub issue

Environment data

  • VS Code version: 1.49.3
  • Extension version (available under the Extensions sidebar): v2020.9.114305
  • OS and version: Windows 10 2004
  • Python version (& distribution if applicable, e.g. Anaconda): 3.8.6
  • Type of virtual environment used (N/A | venv | virtualenv | conda | …): N/A
  • Relevant/affected Python packages and their versions:
  • Relevant/affected Python-related VS Code extensions and their versions: Pylance (v2020.10.0)
  • Value of the python.languageServer setting: Jedi

Expected behaviour

Changed the language server to Pylance, and it should stay Pylance.

Actual behaviour

Pylance extension suggests me to change to it’s language server. Pylance suggestion to change language server

Click ‘Yes, and reload’

settings.json settings.json

Python extension changes the language server back to Jedi and asks me to reload Python extension asking to reload the window

I go check settings.json and to my surprise: settings.json

Steps to reproduce:

  1. Install Python extension and Pylance extension.

  2. Create Python ‘project’ with these settings in .vscode

settings.json:

{
    "python.pythonPath": "C:\\Users\\tiago\\AppData\\Local\\Programs\\Python\\Python38\\python.exe"
}

launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: Current File",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "externalTerminal"
        }
    ]
}
  1. Python code:
print('hello')

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
jakebaileycommented, Oct 8, 2020

Thanks for confirming. For reference, it’s this way because before the languageServer setting was the only setting, jediEnabled needed to be set explicitly to false to get any LS to work. Now jedi is “just another LS setting”, but for compatibility we had to roll people forward; explicitly setting jedi to true meant that we were forcing it to be the LS.

There’s a TODO to remove this, as at this point I’m not expecting there to be many machines configured this way intentionally anymore.

1reaction
jakebaileycommented, Oct 8, 2020

Can you check that file to see if there’s a setting python.jediEnabled, even commented out?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pylance Now Default Language Server for Python in Visual ...
"Today, we're excited to announce that the Python extension's default language support is now powered by Pylance, said Savannah Ostrowski, ...
Read more >
How to switch vscode to use pylance rather than jedi?
I've downloaded the default Python extension, but only the jedi language server is running. How can I make the switch? EDIT: Adding a...
Read more >
Language Server Extension Guide - Visual Studio Code
Learn how to create Language Servers to provide rich language features in Visual Studio Code.
Read more >
Python in Visual Studio Code – May 2021 Release
We're thrilled to announce that Pylance is now the default language server for Python and is bundled with the core Python extension as...
Read more >
Pylance: our new and improved Python experience in VS Code
Get a glimpse of the most performant and user-friendly editing experience for Python in VS Code ever. The newest version of the extension...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found