-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tracking Issue: Language Server Selection #10906
Comments
… run (#10911) This PR adds a new `language_servers` setting underneath the language settings. This setting controls which of the available language servers for a given language will run. The `language_servers` setting is an array of strings. Each item in the array must be either: - A language server ID (e.g., `"rust-analyzer"`, `"typescript-language-server"`, `"eslint"`, etc.) denoting a language server that should be enabled. - A language server ID prefixed with a `!` (e.g., `"!rust-analyzer"`, `"!typescript-language-server"`, `"!eslint"`, etc.) denoting a language server that should be disabled. - A `"..."` placeholder, which will be replaced by the remaining available language servers that haven't already been mentioned in the array. For example, to enable the Biome language server in place of the default TypeScript language server, you would add the following to your settings: ```json { "languages": { "TypeScript": { "language_servers": ["biome", "!typescript-language-server", "..."] } } } ``` More details can be found in #10906. Release Notes: - Added `language_servers` setting to language settings for customizing which language server(s) run for a given language.
@maxdeviant I have a LSP usecase and would like to know if this should work at the moment, of after the language server selection feature. I want to add Would this work? I would expect diagnostics & code actions to come from both language servers |
Tried to use a different Python LSP, but this does not work "languages": {
"Python": {
"language_servers": ["pylsp", "!pyright"]
}
} |
I tried killing "languages": {
"Python": {
"language_servers": ["ruff-lsp", "pylsp", "!pyright"]
}
} |
my understanding is that before lsp selection, each lsp has to be provided by the zed-core or an extension. And I don't see any ruff-lsp or pylsp extensions yet. For python I could also imagine the python extension (when it's extracted) can select the LSP based on a setting? |
Correct, that is the case for now. It would be nice to be able to register arbitrary language servers simply by creating an entry for them under |
Would be nice to be able to see somewhere in the ui the running language servers |
Looking at the extension API there also has to be some custom conversion logic for every LSP, so not sure if we can get around writing an extension for each of them. Still, especially with python, having multiple active servers is not unusual / needed. Or using pylsp, which supports extensions |
I don't think we're going to support this (at least, there are no plans to as part of this work). As @syphar notes:
Right now the intent is that any language servers should be provided by extensions. |
when having multiple LSP it would be cool to be able to configure which to use for which use-case:
not for my current use-case, but generally I could also imagine having multiple servers for autocompletions. |
@maxdeviant Hi, is there a plan to extract the |
If you'd like to start on extracting the Ruby support into an extension (we can keep it in the |
Maybe related: #11288 |
Awesome, I created a pull request here #11360. Thanks! |
|
That just means that the way to launch the LSP changes, should be easy to account for. And given that ruff is not supported at all yet the new way should probably be the one that is implemented (first, or even only) |
Is there any way for me to see what are the valid language server ids available for me to use currently? |
Another use case: it would be very helpful to be able to select which language server to use on a per-file or per-folder basis. I have a number of projects which use both Deno and Typescript within different folders of the same repo, and I need the correct language server to be used for each file. |
This syntax is really confusing to me. I understand that this handles some advanced scenarios, but it seems like you've introduced a tri-state for something that is conventionally a boolean. What's the difference between Does |
I keep observing My project settings say: {
"languages": {
"Python": {
"language_servers": ["!pyright", "!pyflakes", "pylsp"],
// ...
},
},
// ...
} I have to repeat restarting Zed until I get the second. I'd like to know how to disable the supplementary one. Related: |
This is a tracking issue for adding support for selecting which language servers should run for a given language.
Problem
Today, language servers in Zed are always run when installed and a buffer is opened with a language that has one or more registered language servers.
This can create issues with language servers conflicting with one another when multiple language servers are running for the same language.
There are also cases where a user may want to use an existing language server—provided by Zed or by an extension—with a language that is not registered for use with that language server.
Finally, there are cases where a user may want to disable the use of a particular language server entirely if they do not want to use it.
User Stories
toml
extension for TOML syntax highlighting, but does not want to use thetaplo
language server.*.cshtml
).Proposed Solution
To provide Zed users with the ability to customize which language servers are run, we propose a new
language_servers
field under a given language's settings:The
language_servers
field would be an array consisting of strings corresponding to the IDs of language servers.In addition to specific language server IDs, the following additional syntax would be supported:
"!<language-server-id>"
- Language server IDs may optionally be prefixed with a!
to remove the specified language server from consideration."!typescript-language-server"
would disable thetypescript-language-server
for the given language."..."
- A placeholder to refer to the rest of the registered language servers for a given language.["a", "b", "c"]
and thelanguage_servers
field contains["!a", "..."]
then"..."
would expand to just["b", "c"]
.The introduction of the
language_servers
setting would supersede the following partial solutions we currently have in place to address these issues in a non-general fashion:elixir.lsp
settingdeno.enable
settingtypescript-language-server
andeslint
.User Stories
User A would add the following to their settings to use the Biome language server for their
.ts
and.tsx
files:Zed currently offers two language servers for Elixir:
elixir-ls
andnext-ls
.elixir-ls
is currently used by default.If User B wants to prefer
next-ls
overelixir-ls
they can do:This would give
next-ls
precedence overelixir-ls
due to being first in the list. If User B wants to disableelixir-ls
entirely (to prevent it from running at all), they could do:User C would add the following to their language settings to disable the
taplo
language server for TOML files:User D would add the following to their language settings to enable Zed's built-in Tailwind language server for their Razor files:
Steps
language_servers
setting for customizing which language servers should run (Addlanguage_servers
setting for customizing which language servers run #10911)tailwindcss-language-server
withlanguage_servers
setting (Allow controlling Tailwind via thelanguage_servers
setting #11012)language_servers
settings for languagesRelated Issues
Biome
Deno
deno.enable
per-project / using local settings #10169Elixir
Ruby
The text was updated successfully, but these errors were encountered: