Providing primary/secondary language servers in an extension #15279
Labels
enhancement
[core label]
extension infrastructure
Feedback for extensions APIs, creation, management, etc
language server
An umbrella label for all language servers
potential extension
Functionality that could be implemented as an extension (consider moving to community extensions)
Check for existing issues
Describe the feature
Hi, I would like to propose a small addition to extensions to give them a way to provide primary or secondary language servers. That sounds unusual because we used to work with a single language server per language: Ruby LSP for Ruby,
rust-analyzer
for Rust. There is one problem that happens from time to time - a single language server is not enough because various language servers, despite following LSP specification, can provide different results for the code. For example, for the Go language there isgopls
language server that also provides formatting of the code but users also pick alternative options likegofmt
(or evengofumpt
) orgoimports
that provide the same LSP commands but with a different result. In order to achieve the best result for the end-user, it becomes a common scenario to use several language servers per single file.Zed currently has built-in support for primary and secondary language servers but this API is not exposed. There are 2 built-in language servers that can be used as secondary:
tailwind-language-server
andeslint
. I think it's a matter of time when users will ask about addingoxc
orrome
orbiomejs
as language servers. These servers act as linters (most of them) and adding them as primary language servers could conflict with existing primary language servers (#15023). I suspect this situation is not unique to JavaScript or Go.It would be useful to have an ability to expose not only primary, but also secondary language servers in an extension. This is just a proposal, and I would like to propose the following:
language_servers.<language_server_id>
field, which defines a language server adapter, for instance, for the Ruby language:primary
could be enough to indicate this particular language server is primary or not. This field is set totrue
by default, i.e. if field is missing from thelanguage_server
registration, treat it astrue
.With
primary
field set tofalse
, this language server will be registered as a secondary language server. Alternatively, to avoid confusion, instead of theprimary
field, there could be thesecondary
field which negates the idea of theprimary
field:All in all, this feature will allow extensions to provide secondary language servers, such as additional linters. Additionally, it could mean the extraction of tailwind and eslint language servers into their own extensions. I hope I've described this feature well enough, but if not, please let me know. Thank you!
If applicable, add mockups / screenshots to help present your vision of the feature
No response
The text was updated successfully, but these errors were encountered: