mirror of
https://github.com/tiennm99/serena.git
synced 2026-10-19 10:15:20 +00:00
Add BasedPyright as alternative LSP for Python (#1705)
This commit is contained in:
1 parent
2c10e25c97
commit
96ee9b65e2
10 files changed
+499
-12
No files matched your search
@@ -969,16 +969,43 @@ Supported settings:
|
||||
|
||||
#### Python
|
||||
|
||||
Serena uses Pyright for the `python` language key.
|
||||
Serena supports several Python language servers through separate language keys.
|
||||
|
||||
##### Pyright (`python`)
|
||||
|
||||
Pyright is the default Python language server.
|
||||
|
||||
Supported settings:
|
||||
|
||||
| Setting | Default | Description |
|
||||
|---|---|---|
|
||||
| `ls_path` | current Python executable | Override the Python interpreter Serena uses to run `-m pyright.langserver`. |
|
||||
| `pyright_version` | `1.1.403` | Override the exact Pyright package version Serena launches through `uvx` / `uv tool run`. |
|
||||
| `ls_path` | managed executable | Override `pyright-langserver` and bypass the managed `uvx` / `uv tool run` invocation. The default `--stdio` argument is still applied. |
|
||||
|
||||
Note:
|
||||
- There is currently no separate `python_ty` language key in Serena's current SolidLSP implementation.
|
||||
##### BasedPyright (`python_basedpyright`)
|
||||
|
||||
To use [BasedPyright](https://github.com/DetachHead/basedpyright), select its separate experimental
|
||||
language key:
|
||||
|
||||
```yaml
|
||||
languages: [python_basedpyright]
|
||||
ls_specific_settings:
|
||||
python_basedpyright:
|
||||
basedpyright_version: "1.39.9"
|
||||
```
|
||||
|
||||
Supported settings:
|
||||
|
||||
| Setting | Default | Description |
|
||||
|---|---|---|
|
||||
| `basedpyright_version` | `1.39.9` | Override the exact BasedPyright package version Serena launches through `uvx` / `uv tool run`. |
|
||||
| `ls_path` | managed executable | Override `basedpyright-langserver` and bypass the managed `uvx` / `uv tool run` invocation. The default `--stdio` argument is still applied. |
|
||||
|
||||
The generic [language-server launch settings](override-ls-path), including `ls_base_cmd`, `ls_args`,
|
||||
and `ls_extra_args`, apply to both servers. `ls_args` replaces the default arguments, while
|
||||
`ls_extra_args` appends to them.
|
||||
|
||||
Other alternative Python language keys are `python_ty`, `python_pyrefly`, and `python_jedi`.
|
||||
|
||||
#### Ruby
|
||||
|
||||
|
||||
@@ -109,7 +109,10 @@ Some parts of Serena rely on `uv` / `uvx`.
|
||||
|
||||
One important detail is that `uvx` ignores the lockfile when installing directly from a Git repository. Because of that, we pin Serena's Python dependencies exactly in `pyproject.toml` so that installations from Git still resolve to exact dependency versions rather than floating ranges.
|
||||
|
||||
For the `ty` Python language server, Serena also uses an exact pinned version when invoking it through `uvx`.
|
||||
For the Pyright, BasedPyright, and `ty` Python language servers, Serena uses exact pinned versions when
|
||||
invoking them through `uvx` / `uv tool run`. Pyright and BasedPyright default to `1.1.403` and `1.39.9`,
|
||||
respectively; `ls_specific_settings.python.pyright_version` and
|
||||
`ls_specific_settings.python_basedpyright.basedpyright_version` can override those pins.
|
||||
|
||||
```{dropdown} What Serena Downloads by Default for Language Servers
|
||||
:open:
|
||||
@@ -162,11 +165,14 @@ All of the above are installed with exact pinned package versions by default, in
|
||||
|
||||
- **F#**: installs pinned `fsautocomplete` via `dotnet tool install`.
|
||||
- **Ruby (`ruby-lsp`)**: if not already available through Bundler or as a global executable, Serena installs a pinned `ruby-lsp` gem.
|
||||
- **Python (`ty`)**: launched through `uvx` / `uv x` using an exact pinned `ty` version.
|
||||
- **Python (`python`)**: Pyright is launched through `uvx` / `uv tool run` using an exact pinned version.
|
||||
Supplying `ls_path` bypasses this managed invocation.
|
||||
- **Python (`python_basedpyright`)**: BasedPyright is launched through `uvx` / `uv tool run` using an exact
|
||||
pinned version. Supplying `ls_path` bypasses this managed invocation.
|
||||
- **Python (`python_ty`)**: launched through `uvx` / `uv tool run` using an exact pinned `ty` version.
|
||||
- **HLSL on macOS**: if no prebuilt binary is used, Serena builds `shader_language_server` from a pinned version using Cargo.
|
||||
|
||||
### No Automatic Download by Serena
|
||||
|
||||
- **Python (`pyright`)**: Serena uses the locally available Python environment and starts `pyright.langserver` from there.
|
||||
- **Go (`gopls`)**, **Rust (`rust-analyzer`)**, and several other system-tool based integrations expect the language server to be available locally and do not download it automatically.
|
||||
```
|
||||
Reference in new issue
Block a user