[FEATURE]: ty + ruff lsp rather than pyright #3455

Open
opened 2026-02-16 17:40:08 -05:00 by yindo · 10 comments
Owner

Originally created by @vlashada on GitHub (Dec 10, 2025).

Feature hasn't been suggested before.

  • 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!

Originally created by @vlashada on GitHub (Dec 10, 2025). ### Feature hasn't been suggested before. - [x] I have verified this feature I'm about to request hasn't been suggested before. ### Describe the enhancement you want to request The [ty](https://docs.astral.sh/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!
yindo added the help-wanteddiscussion labels 2026-02-16 17:40:08 -05:00
Author
Owner

@rekram1-node commented on GitHub (Dec 10, 2025):

Yeah I was thinking about this.

@rekram1-node commented on GitHub (Dec 10, 2025): Yeah I was thinking about this.
Author
Owner

@rekram1-node commented on GitHub (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

@rekram1-node commented on GitHub (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
Author
Owner

@vlashada commented on GitHub (Dec 10, 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

@vlashada commented on GitHub (Dec 10, 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
Author
Owner

@rekram1-node commented on GitHub (Dec 10, 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 commented on GitHub (Dec 10, 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
Author
Owner

@rekram1-node commented on GitHub (Dec 10, 2025):

flag.ts, lsp.ts relevant files i think its called lsp.ts or its lsp/server.ts

@rekram1-node commented on GitHub (Dec 10, 2025): flag.ts, lsp.ts relevant files i think its called lsp.ts or its lsp/server.ts
Author
Owner

@debjan commented on GitHub (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

@debjan commented on GitHub (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
Author
Owner

@OpeOginni commented on GitHub (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 venv and call the binary from there. Which of these approach you think is best?

@OpeOginni commented on GitHub (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 `venv` and call the binary from there. Which of these approach you think is best?
Author
Owner

@rekram1-node commented on GitHub (Dec 15, 2025):

@OpeOginni prolly best to not auto install it, should use it if it exists instead

@rekram1-node commented on GitHub (Dec 15, 2025): @OpeOginni prolly best to not auto install it, should use it if it exists instead
Author
Owner

@OpeOginni commented on GitHub (Dec 15, 2025):

@rekram1-node thanks, Let me know what you think

@OpeOginni commented on GitHub (Dec 15, 2025): @rekram1-node thanks, Let me know what you think
Author
Owner

@ajanvrin commented on GitHub (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 https://github.com/astral-sh/ty-vscode/issues/204), so that's what I make available in my environment (via custom LSP config in opencode.jsonc)

The next best thing would be:

  1. Detect whether any supported LSP is available, if yes, run that
  2. 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.

@ajanvrin commented on GitHub (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 https://github.com/astral-sh/ty-vscode/issues/204), so that's what I make available in my environment (via custom LSP config in opencode.jsonc) The next best thing would be: 1. Detect whether any supported LSP is available, if yes, run that 2. 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.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#3455