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.

Test language servers with Python 2.7

See original GitHub issue

Refs: https://github.com/microsoft/vscode-python/issues/17225

Complexity: 3

Create Issue


Requirements

  1. You will need Python 2.7.16. Options are:
    • You can install it from python.org
    • On Mac/Linux, you can install it using your local package manager
    • For a managed solution that will allow you to install multiple versions of Python you can use pyenv on Mac/Linux, or pyenv-win on Windows, and call pyenv install 2.7.16
  2. Install virtualenv with python 2.7: path/to/python2 -m pip install virtualenv
  3. Make sure you have "python.experiments.optInto": ["All"], in your user settings. If not, add it and reload VS Code.
  4. Make sure the python.defaultInterpreterPath entries in your user and workspace settings are at their default value python
  5. Use the latests Insiders build of the Python extension (set python.insidersChannel to daily, wait for the download and installation to happen and reload VS Code)

Scenario 1: Jedi

  1. Create a folder with a Python file, and add the following .vscode/settings.json:
{
   "python.languageServer": "Jedi"
}
  1. Create a Python 2.7 virtual environment in that folder: /path/to/python2 -m virtualenv .venv
  2. Open the folder in VS Code, wait for the extension to load and the virtual environment to get auto-selected
  3. In the Python output panel, verify that Editor support is inactive since language server is set to None. is printed, and that language server capabilities are disabled

Scenario 2: Default

  1. Create a folder with a Python file, and add the following .vscode/settings.json:
{
   "python.languageServer": "Default"
}
  1. Create a Python 2.7 virtual environment in that folder: /path/to/python2 -m virtualenv .venv
  2. Open the folder in VS Code, wait for the extension to load and the virtual environment to get auto-selected
  3. In the Python output panel, verify that Starting Pylance language server. is printed, and that language server capabilities are working

Scenario 3: Pylance

  1. Create a folder with a Python file, and add the following .vscode/settings.json:
{
   "python.languageServer": "Pylance"
}
  1. Create a Python 2.7 virtual environment in that folder: /path/to/python2 -m virtualenv .venv
  2. Open the folder in VS Code, wait for the extension to load and the virtual environment to get auto-selected
  3. In the Python output panel, verify that Starting Pylance language server. is printed, and that language server capabilities are working

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
isidorncommented, Sep 28, 2021

I do not have Python setup on my Linux, thus I have swapped platform assignments with @mjbvz . I hope that is fine.

0reactions
brettcannoncommented, Sep 28, 2021

@mjbvz I took you off as I accidentally verified under Linux out of habit from launching VS Code under WSL. 😄 I also went ahead and verified under Windows as well.

Read more comments on GitHub >

github_iconTop Results From Across the Web

python-language-server - PyPI
python-language-server 0.36.2 ... A Python 2.7 and 3.5+ implementation of the Language Server Protocol. ... To run the test suite: pip install ....
Read more >
Python LSP Server - GitHub
The base language server requires Jedi to provide Completions, Definitions, Hover, References, Signature Help, and Symbols: pip install python-lsp-server.
Read more >
Python in Visual Studio Code – September 2021 Release
A rich Python editing experience in the browser; Revamped testing ... Python Language Server's end of life, as well as for Python 2.7...
Read more >
How do you set up a local testing server? - MDN Web Docs
Running a simple local HTTP server · Go to python.org · Under the Download section, click the link for Python "3. · At...
Read more >
Settings Reference for Python - Visual Studio Code
For example, for the arguments --a --b --c {"value1" : 1, "value2" : 2} , the list items should be ... The language...
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