Language Server for the Rextio native-promotion tooling contract.
Project description
rextio-lsp
Language Server for Rextio — native-promotion routes and guidance in your editor.
A Python (pygls) LSP server that runs inside your project's environment, imports the Rextio analyzer in-process, and reports per-function execution routes (native-direct, native-plugin:<id>, native-shim, fallback-python, fallback-accelerated:numba, rejected:<RXT>) with actionable promotion guidance.
Designed to coexist
rextio-lsp registers only Rextio-semantic capabilities and stays out of everything else:
- Provides: diagnostics (
source: "rextio", RXT/RXTP codes only, default Hint/Info severity), hover (route info + rejection and advisory guidance), code lens (per-function route badges), code actions (promotion quick fixes) - Does not provide: completion, formatting, rename, definition, references, syntax/style linting — those remain with your existing Python LSP (Pylance/pyright, ruff, …)
- Activates only when
rextio.tomlexists in the workspace; silent no-op when Rextio isn't installed in the project environment
Features
M1
- Whole-project
rextio checkon open/save (debounced), published assource: "rextio"diagnostics - Severity is capped: rejection codes → Warning, informational codes (RXT075/080/090/091) → Hint, everything else → Information (never Error)
- Hover on a function definition line shows its route, native status, and rejection guidance (from the capability manifest)
- Acquisition prefers importing the project's own
rextioin-process, falling back to a discoveredrextiobinary subprocess - Unsupported contract major → degraded (generic) diagnostics without guidance enrichment
M2
initializationOptionscontract (see below): toggle code lens, pin the interpreter used for binary discovery- Code lens: one
Rextio: <route>lens per analyzed function, carrying the informationalrextio.showRouteInfocommand with[qualname](registered only whencodeLens.enableis true) - Code actions (quickfix): on a rejected function that carries an explicit
@rextio.nativemarker, offer "Rextio: keep on Python fallback (@rextio.exempt)" — rewrites the decorator to@rextio.exempt(indentation preserved) - Hover also surfaces an Advisory section for informational codes present on the function, not just rejections
- Watches
**/rextio.toml; on change, drops the project's cached capability manifest and re-analyzes open documents - Real diagnostic spans when the contract provides
end_line/end_column(else a zero-width range) - Latency instrumentation: each whole-project check is logged via
window/logMessage(Info when > 2.0s, else Log)
initializationOptions
The server reads the following shape (all keys optional; defaults shown):
{
"codeLens": { "enable": true },
"interpreter": { "path": null }
}
codeLens.enable— whenfalse, the code lens capability is not advertised at all.interpreter.path— path to the project's Python interpreter. When set, it is consulted first when locating therextiobinary for the subprocess fallback (before the project.venv/venvandPATH).
Install
Install into the project environment so the server stays in version lock-step with the project's rextio and its plugins:
pip install rextio-lsp
The server speaks LSP over stdio via the rextio-lsp console script (equivalently python -m rextio_lsp).
Editor setup
Neovim (nvim-lspconfig, manual command)
rextio-lsp is not yet a built-in lspconfig server, so register it manually:
local configs = require("lspconfig.configs")
local lspconfig = require("lspconfig")
if not configs.rextio_lsp then
configs.rextio_lsp = {
default_config = {
-- run the server from the project's own environment
cmd = { ".venv/bin/rextio-lsp" },
filetypes = { "python" },
root_dir = lspconfig.util.root_pattern("rextio.toml"),
init_options = {
codeLens = { enable = true },
interpreter = { path = vim.fn.getcwd() .. "/.venv/bin/python" },
},
},
}
end
lspconfig.rextio_lsp.setup({})
Enable code lens rendering with vim.lsp.codelens.refresh() (e.g. on BufEnter/CursorHold) and :lua vim.lsp.codelens.display().
Generic stdio client
Any LSP client that launches a stdio subprocess works. The essentials:
- command:
rextio-lsp(orpython -m rextio_lsp) from the project environment - transport: stdio
- languages:
python - root: nearest directory containing
rextio.toml - initializationOptions: the shape documented above
Development
pip install -e '.[dev]'
ruff check src tests
mypy
pytest -q
Integration tests marked needs_rextio are auto-skipped when rextio is not importable.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rextio_lsp-0.1.0.tar.gz.
File metadata
- Download URL: rextio_lsp-0.1.0.tar.gz
- Upload date:
- Size: 48.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
86edba9e9e9e025741b119f731227e3768da807cb20b216ef34a45dc9d793663
|
|
| MD5 |
ead9de56b6fd59186f0f598e436394a5
|
|
| BLAKE2b-256 |
1ab6a36aa3863ddc58df2297c66f729a47f5dc3178e8f7ba6b57f92f33deedf8
|
File details
Details for the file rextio_lsp-0.1.0-py3-none-any.whl.
File metadata
- Download URL: rextio_lsp-0.1.0-py3-none-any.whl
- Upload date:
- Size: 30.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
55e99f367732ba61b8f8b0935bc6f06bdf0ceac93615d50eef7508a53475ee27
|
|
| MD5 |
098d2c61ed75e708ee20c3ed093790ff
|
|
| BLAKE2b-256 |
ba3d417c0305aca0982f203cb36f4443e3e1edb283fec3c8f6d1c96e84aac535
|