Skip to content

Commit

Permalink
Add a bit of documentation for virtual environments (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
rchl authored May 27, 2021
1 parent 1d28c04 commit 81fabfe
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions LSP-pylsp.sublime-settings
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
"MYPY_PATH": "$sublime_py_files_dir:$packages"
},
// --- JEDI configuration ---------------------------------------------
// If you are using a virtual environment, specify a path to it to here.
// "pylsp.plugins.jedi.environment": "./.venv/myproject",
"pylsp.plugins.jedi.extra_paths": [
"$sublime_py_files_dir",
"$packages"
Expand Down
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ To use this package, you must have:
- An executable `python` (on Windows) or `python3` (on Linux/macOS)
- The [LSP](https://packagecontrol.io/packages/LSP) package
- For Ubuntu and Debian users, you must also install `python3-venv` with `apt`
- It's recommended to also install the `LSP-json` package which will provide autocompletion and validation for this package's settings.

## Applicable Selectors

Expand All @@ -27,6 +28,20 @@ case, that means that when you open a view with the `source.python` base scope,

Configure the Python LSP Server by accessing `Preferences > Package Settings > LSP > Servers > LSP-pylsp`.

### Virtual environments

If your project needs to run and be validated within a virtual environment, point to it using the `pylsp.plugins.jedi.environment` settings. For example if your virtual environment lives in `.venv/myproject` within the the project directory then set it like so:

```json
{
"settings": {
"pylsp.plugins.jedi.environment": "./.venv/myproject",
}
}
```

You can set it in `LSP-pylsp` global settings or (more likely) override it per project.

## Code Completion

This language server provides code completion through JEDI.
Expand Down

0 comments on commit 81fabfe

Please sign in to comment.