You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE]: ty + ruff lsp rather than pyright #5345
I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
The ty lsp is starting to get a lot better and is so much faster than pyright which can allow us to run the lsp much more liberally for large code bases. It would be great if there was an option to select if we want to use pyright or ty!
It is quite stable and mostly on par with pyright in terms of correctness, but it is technically still in alpha (although very close to beta). I think pyright should probably be the default for a few more weeks/months, but it would be nice to allow people to switch to ty since it is basically ready for production
if u (or anyone else) is up to id accept a pr w an opencode experimental flag for lsp ty and then it should disable pyright, ty should only run if the flag is set
@rekram1-node Taking a look at this, ways to install the lsp is either with brew, or like pip, to go with pip we have to make a venv and call the binary from there. Which of these approach you think is best?
My two bits on this (Python has been my primary language for a decade):
The Python ecosystem is complicated, confusing and fragmented.
It's not OpenCode's place to knight such or such LSP server as the "One supported LSP server".
IMHO it's best to not try to install one, and to support all the LSP servers that are available (already installed).
I'd remove the experimental check and run ty if it's installed, pyright if it's installed, and ruff if it's installed.
It's up to the Python dev to know which he wants to use, and handle potential conflicts.
Ruff and Ty are supposed to be running together for now (see astral-sh/ty-vscode#204), so that's what I make available in my environment (via custom LSP config in opencode.jsonc)
The next best thing would be:
Detect whether any supported LSP is available, if yes, run that
If no LSP are found, automatically add ty and ruff as project dev dependencies and run that
But it's not really necessary, it's ok to just run whatever is available.
Pylance/pyright causes significant CPU usage especially in larger Python projects. On my machine, I've noticed the language server consuming high CPU even during idle periods, which impacts the overall development experience.
Why ruff would be better:
Much lighter weight - ruff is written in Rust and is significantly faster
Lower memory footprint - important for long coding sessions
Faster startup - nearly instant compared to pylance's initialization time
Same diagnostics - ruff covers most of what we need (linting, formatting, some type hints)
Broader Proposal: Configurable LSP per language
Rather than just swapping pyright for ruff, I think OpenCode should allow users to configure any LSP for any language via `opencode.json`:
Reacted by Juan Luis Cano Rodríguez, Rabin Adhikari, Manohar Maharshi and Aleksei Beresnev
Reacted by Jack Kelly, enprop, Victor J. Diaz Ayuste, Laurens Bosscher, Christian Kreiling, seanmamasde, PyreZ, Jemma Nelson, Fernando Moreno Valles, Hao_Ming and 2 more
Reacted by ScDor, Laurens Bosscher, Benjamin, Ankur Sinha, Paweł Prażak, Rabin Adhikari and Samuel Ochoa
Activity
rekram1-node commentedon Dec 10, 2025
Yeah I was thinking about this.
rekram1-node commentedon Dec 10, 2025
I haven't touched python much is ty out of beta yet? Would it be a sane default yet? The speed is something that'd be rlly good
vlashada commentedon Dec 11, 2025
It is quite stable and mostly on par with pyright in terms of correctness, but it is technically still in alpha (although very close to beta). I think pyright should probably be the default for a few more weeks/months, but it would be nice to allow people to switch to ty since it is basically ready for production
rekram1-node commentedon Dec 11, 2025
if u (or anyone else) is up to id accept a pr w an opencode experimental flag for lsp ty and then it should disable pyright, ty should only run if the flag is set
rekram1-node commentedon Dec 11, 2025
flag.ts, lsp.ts relevant files i think its called lsp.ts or its lsp/server.ts
debjan commentedon Dec 11, 2025
it can be added as custom lsp in settings, although I can't see the the point, as ruff is the way to go for llm interaction imho
OpeOginni commentedon Dec 15, 2025
@rekram1-node Taking a look at this, ways to install the lsp is either with brew, or like pip, to go with pip we have to make a
venvand call the binary from there. Which of these approach you think is best?rekram1-node commentedon Dec 15, 2025
@OpeOginni prolly best to not auto install it, should use it if it exists instead
OpeOginni commentedon Dec 15, 2025
@rekram1-node thanks, Let me know what you think
ajanvrin commentedon Jan 8, 2026
My two bits on this (Python has been my primary language for a decade):
The Python ecosystem is complicated, confusing and fragmented.
It's not OpenCode's place to knight such or such LSP server as the "One supported LSP server".
IMHO it's best to not try to install one, and to support all the LSP servers that are available (already installed).
I'd remove the experimental check and run ty if it's installed, pyright if it's installed, and ruff if it's installed.
It's up to the Python dev to know which he wants to use, and handle potential conflicts.
Ruff and Ty are supposed to be running together for now (see astral-sh/ty-vscode#204), so that's what I make available in my environment (via custom LSP config in opencode.jsonc)
The next best thing would be:
But it's not really necessary, it's ok to just run whatever is available.
[-][FEATURE]: ty lsp rather than pyright[/-][+][FEATURE]: ty + ruff lsp rather than pyright[/+]aliefe04 commentedon Mar 23, 2026
Adding my +1 to this with a specific pain point:
Pylance/pyright causes significant CPU usage especially in larger Python projects. On my machine, I've noticed the language server consuming high CPU even during idle periods, which impacts the overall development experience.
Why ruff would be better:
Broader Proposal: Configurable LSP per language
Rather than just swapping pyright for ruff, I think OpenCode should allow users to configure any LSP for any language via `opencode.json`:
```json
{
"lsp": {
"python": "ruff",
"typescript": "biome",
"go": "gopls",
"rust": "rust-analyzer"
}
}
```
This would:
This is somewhat related to #9472 but I wanted to emphasize the performance/CPU angle as a key motivator.
debjan commentedon Mar 23, 2026
@aliefe04 it is already possible:
{ "lsp": { "ruff": { "command": ["ruff", "server"], "extensions": [".py"] }, "ty": { "command": ["ty", "server"], "extensions": [".py"] }, "pyright": { "disabled": true } } }Tell opencode to use ruff and ty.
github-actions commentedon Jul 3, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.