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

  • 1.2.79
    1.2.42
  • github.​com
  • github.​com
  • 2 days ago
  • 3 hours ago
  • 4 years ago

Installs

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

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. (Optional but recommended) Install the LSP-file-watcher-chokidar via Package Control to enable functionality to notify the server about new files.
  3. Restart Sublime.
  4. (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
              }
           }
        }
     }
  }
  • Various options can only be configured through a pyrightconfig.json configuration file (check Pyright configuration for more info)

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

The plugin attempts to resolve the virtual environment automatically from well-known environment variables and workspace files. This behavior can be disabled by explicitly setting the python interpreter in the python.pythonPath setting.

If you want to overwrite the 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.