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

LSP-pyright

by sublimelsp ST3

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

Details

Installs

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

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 12.

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.