Skip to content

Conversation

@camerondugan
Copy link

An implementation for global language server config. Feel free to make modifications to better suit the code base, I'm still pretty unfamiliar.

Adds top-level option to languages.toml

global-language-servers = ["harper-ls"] # useful for spelling/grammar/snippet LSPs that like to be on every file type.

Any language server added here, will be added if missing into the list with every other language present.

Also, per language, adds the option to specify:

[[language]]
name = "rust"
ignore-global-language-servers = true

@RoloEdits
Copy link
Contributor

Not necessarily for this pr, but want to link to #14769 where the idea is to follow zeds config syntax to allow appending, and in zeds case also excluding, language servers.


Choosing Language Servers

Some languages in Zed offer multiple language server options. You might have multiple extensions installed that bundle language servers targeting the same language, potentially leading to overlapping capabilities. To ensure you get the functionality you prefer, Zed allows you to prioritize which language servers are used and in what order.

You can specify your preference using the language_servers setting:

  "languages": {
    "PHP": {
      "language_servers": ["intelephense", "!phpactor", "..."]
    }
  }

In this example:

  • intelephense is set as the primary language server
  • phpactor is disabled (note the ! prefix)
  • ... expands to the rest of the language servers that are registered for PHP

This configuration allows you to tailor the language server setup to your specific needs, ensuring that you get the most suitable functionality for your development workflow.


For example, instead of a config field to ignore the global list, there could be instead the ! exclusion syntax.

@camerondugan
Copy link
Author

Agreed that something like this would be nice, unfortunately is mostly orthogonal to this. I'm interested enough to attempt a pr to get this functionality, can't promise it will come anytime soon, if at all.

@camerondugan
Copy link
Author

I've just been nerd sniped by @RoloEdits. I couldn't stop thinking about how this would work.

@jerabaul29
Copy link
Contributor

Nice, I would love this feature, especially as we are dependent on lsps for snippets, spellcheck etc as you point out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants