Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: clean up information about virtual envs #35

Merged
merged 6 commits into from
Dec 1, 2020
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 35 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,58 @@
# LSP-pyright

Python support for Sublime's LSP plugin provided through [microsoft/pyright](https://github.com/microsoft/pyright).
Python support for Sublime's LSP plugin provided through [microsoft/pyright](https://github.com/microsoft/pyright).

## Installation

1. Install [LSP](https://packagecontrol.io/packages/LSP) and
[LSP-pyright](https://packagecontrol.io/packages/LSP-pyright) via Package Control.
1. Restart Sublime.
1. Configure pyright for your virtualenv.
2. Restart Sublime.
3. (Optional) Configure pyright for your `virtualenv`.

## Configuration

There are some ways to configure the package and the language server.
> **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:

```js
{
"settings": {
"LSP": {
"LSP-pyright": {
"settings": {
// Put your settings here
}
}
}
}
}
```

Project specific settings can also be set for LSP-pyright (and all LSP plugins):
- Through a `pyrightconfig.json` configuration file (check [settings documentation](https://github.com/microsoft/pyright/blob/master/docs/configuration.md))

- From the command palette `Project: Edit Project`
### Virtual environments

Your project will also require a `pyrightconfig.json` file, usually in the project root.
If your project needs to run and be validated within a virtual environment, the `pyrightconfig.json` file needs to be
presented at the root of your project.
jfcherng marked this conversation as resolved.
Show resolved Hide resolved

At a minimum, the file should define where your Python virtualenvs are located and the name of the one to use for your project:
The configuration file, at a minimum, should define where your Python virtualenvs are located and the name of the one to
use for your project:

```json
{
"venvPath": "/path/to/virtualenvs/",
"venv": "env"
"venv": "myenv"
}
```
Please see the [Pyright Docs](https://github.com/microsoft/pyright/blob/master/docs/configuration.md) for more options.

The `venv` option is only supported in the `pyrightconfig.json` file. The `venvPath` can be moved to other places like
project-specific configuration, in case you don't want to hard-code system-specific path in a shared project.

Please see [Pyright Documentation](https://github.com/microsoft/pyright/blob/master/docs/configuration.md) for more options.