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

  • 1.4.33
    1.2.42
  • github.​com
  • github.​com
  • 1 week ago
  • 32 minutes ago
  • 4 years ago

Installs

  • Total 22K
  • Win 9K
  • Mac 6K
  • Linux 7K
Nov 21 Nov 20 Nov 19 Nov 18 Nov 17 Nov 16 Nov 15 Nov 14 Nov 13 Nov 12 Nov 11 Nov 10 Nov 9 Nov 8 Nov 7 Nov 6 Nov 5 Nov 4 Nov 3 Nov 2 Nov 1 Oct 31 Oct 30 Oct 29 Oct 28 Oct 27 Oct 26 Oct 25 Oct 24 Oct 23 Oct 22 Oct 21 Oct 20 Oct 19 Oct 18 Oct 17 Oct 16 Oct 15 Oct 14 Oct 13 Oct 12 Oct 11 Oct 10 Oct 9 Oct 8 Oct 7
Windows 3 5 11 11 16 8 14 0 0 12 15 16 8 12 14 12 11 19 11 10 11 11 9 6 8 6 10 11 13 7 14 5 15 11 9 11 17 12 10 8 13 14 19 9 10 8
Mac 1 1 1 3 7 5 1 0 0 5 4 4 6 7 4 10 10 6 5 3 7 5 3 5 5 5 5 3 4 2 11 5 5 2 5 2 6 6 6 5 8 11 3 4 5 3
Linux 2 4 3 14 10 7 8 0 0 8 11 13 4 7 5 8 12 9 1 6 7 14 11 8 6 7 6 8 6 10 8 7 9 4 0 5 8 12 14 20 11 13 13 11 6 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.