LSP-pyright
Python support for Sublime's LSP plugin provided through microsoft/pyright.
Details
Installs
- Total 12K
- Win 4K
- Mac 3K
- Linux 4K
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 | 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 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Windows | 1 | 6 | 10 | 9 | 3 | 6 | 6 | 6 | 7 | 10 | 14 | 8 | 19 | 12 | 6 | 11 | 12 | 8 | 6 | 10 | 1 | 20 | 6 | 11 | 9 | 3 | 4 | 8 | 11 | 6 | 11 | 2 | 6 | 15 | 12 | 7 | 3 | 6 | 10 | 1 | 5 | 3 | 7 | 9 | 15 | 18 |
Mac | 0 | 10 | 7 | 4 | 7 | 10 | 5 | 6 | 9 | 6 | 7 | 5 | 7 | 6 | 6 | 1 | 6 | 7 | 6 | 2 | 5 | 5 | 5 | 9 | 4 | 4 | 4 | 17 | 4 | 6 | 7 | 3 | 5 | 2 | 4 | 9 | 5 | 8 | 7 | 5 | 11 | 4 | 5 | 12 | 7 | 6 |
Linux | 3 | 7 | 5 | 5 | 2 | 5 | 5 | 4 | 8 | 3 | 7 | 6 | 3 | 6 | 4 | 7 | 5 | 8 | 7 | 3 | 12 | 4 | 8 | 9 | 6 | 8 | 4 | 6 | 6 | 3 | 7 | 4 | 6 | 5 | 7 | 8 | 8 | 7 | 10 | 7 | 11 | 10 | 7 | 13 | 7 | 15 |
Readme
- Source
- raw.githubusercontent.com
LSP-pyright
Python support for Sublime's LSP plugin provided through microsoft/pyright.
Installation
- Install LSP and LSP-pyright via Package Control.
- (Optional but recommended) Install the LSP-file-watcher-chokidar via Package Control to enable functionality to notify the server about new files.
- Restart Sublime.
- (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 usenode
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 forLSP-pyright
settings and thepyrightconfig.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
}
}
}
}
}
- Through a
pyrightconfig.json
configuration file (check settings documentation)
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.