ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

LSP-pyright

by sublimelsp ST3 Trending

Python support for Sublime's LSP plugin provided through microsoft/pyright.

Details

Installs

  • Total 6K
  • Win 2K
  • Mac 2K
  • Linux 2K
May 17 May 16 May 15 May 14 May 13 May 12 May 11 May 10 May 9 May 8 May 7 May 6 May 5 May 4 May 3 May 2 May 1 Apr 30 Apr 29 Apr 28 Apr 27 Apr 26 Apr 25 Apr 24 Apr 23 Apr 22 Apr 21 Apr 20 Apr 19 Apr 18 Apr 17 Apr 16 Apr 15 Apr 14 Apr 13 Apr 12 Apr 11 Apr 10 Apr 9 Apr 8 Apr 7 Apr 6 Apr 5 Apr 4 Apr 3 Apr 2
Windows 7 7 8 5 5 3 8 8 7 8 5 6 6 10 7 3 8 4 7 10 7 9 9 6 3 6 2 6 3 7 15 14 6 13 4 2 3 1 5 7 8 4 7 5 7 2
Mac 0 11 2 4 8 9 7 7 1 2 3 7 6 11 3 5 2 1 5 9 2 7 8 10 7 3 4 4 4 4 2 4 7 4 7 6 5 5 7 5 4 5 5 3 6 4
Linux 4 8 7 6 1 7 8 0 9 2 4 5 2 9 2 6 3 11 10 6 5 18 4 7 6 8 7 1 7 7 2 3 9 9 7 8 10 7 7 5 2 8 11 7 7 4

Readme

Source
raw.​githubusercontent.​com

LSP-pyright

Python support for Sublime's LSP plugin provided through microsoft/pyright.

Installation

  1. Install LSP and LSP-pyright via Package Control.
  2. Restart Sublime.
  3. (Optional) Configure pyright for your virtualenv.

The Node.js is required by this server. If node is not in your $PATH, this package will suggest to install a local Node.js runtime automatically. If you instead decide to use node that is already installed on your system, make sure that it's at least a version 14.

Configuration

TIP: It's recommended to additionally install the LSP-json package which provides validation and auto-complete for LSP-pyright settings and the pyrightconfig.json configuration file.

Here are some ways to configure the package and the language server.

  • From Preferences > Package Settings > LSP > Servers > LSP-pyright
  • From the command palette Preferences: LSP-pyright Settings
  • Project-specific configuration From the command palette run Project: Edit Project and add your settings in:
{
     "settings": {
        "LSP": {
           "LSP-pyright": {
              "settings": {
                 // Put your settings here
              }
           }
        }
     }
  }

Provided Command Palette commands

Command Description
LSP-pyright: Create Pyright Configuration File Creates a pyrightconfig.json file in the root of the project with basic options. Opens the configuration file if it already exists.

Virtual environments

If your project needs to run and be validated within a virtual environment, the pyrightconfig.json file must be present at the root of your project.

This configuration file, at a minimum, should define where your Python virtualenvs are located, as well as the name of the one to use for your project:

{
    "venvPath": "/path/to/virtualenvs/",
    "venv": "myenv"
}

For example, if you have created a virtual environment inside the directory .venv within the project directory then you would use:

{
    "venvPath": ".",
    "venv": ".venv"
}

Note that the venv option is only supported in the pyrightconfig.json file. The venvPath option can also be specified in your .sublime-project, in case you don't want to hard-code a system-specific path in a shared project.

Please see Pyright Documentation for more options.