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.1.73
  • github.​com
  • github.​com
  • 2 days ago
  • 26 minutes ago
  • 10 months ago

Installs

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

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.