-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Add support for multiple language servers per language #2507
Add support for multiple language servers per language #2507
Commits on May 18, 2023
-
Adds support for multiple language servers per language.
Language Servers are now configured in a separate table in `languages.toml`: ```toml [langauge-server.mylang-lsp] command = "mylang-lsp" args = ["--stdio"] config = { provideFormatter = true } [language-server.efm-lsp-prettier] command = "efm-langserver" [language-server.efm-lsp-prettier.config] documentFormatting = true languages = { typescript = [ { formatCommand ="prettier --stdin-filepath ${INPUT}", formatStdin = true } ] } ``` The language server for a language is configured like this (`typescript-language-server` is configured by default): ```toml [[language]] name = "typescript" language-servers = [ { name = "efm-lsp-prettier", only-features = [ "format" ] }, "typescript-language-server" ] ``` or equivalent: ```toml [[language]] name = "typescript" language-servers = [ { name = "typescript-language-server", except-features = [ "format" ] }, "efm-lsp-prettier" ] ``` Each requested LSP feature is priorized in the order of the `language-servers` array. For example the first `goto-definition` supported language server (in this case `typescript-language-server`) will be taken for the relevant LSP request (command `goto_definition`). If no `except-features` or `only-features` is given all features for the language server are enabled, as long as the language server supports these. If it doesn't the next language server which supports the feature is tried. The list of supported features are: - `format` - `goto-definition` - `goto-declaration` - `goto-type-definition` - `goto-reference` - `goto-implementation` - `signature-help` - `hover` - `document-highlight` - `completion` - `code-action` - `workspace-command` - `document-symbols` - `workspace-symbols` - `diagnostics` - `rename-symbol` - `inlay-hints` Another side-effect/difference that comes with this PR, is that only one language server instance is started if different languages use the same language server.
Configuration menu - View commit details
-
Copy full SHA for 71551d3 - Browse repository at this point
Copy the full SHA 71551d3View commit details -
Configuration menu - View commit details
-
Copy full SHA for 7d4f7eb - Browse repository at this point
Copy the full SHA 7d4f7ebView commit details -
Configuration menu - View commit details
-
Copy full SHA for 74e21e1 - Browse repository at this point
Copy the full SHA 74e21e1View commit details -
Configuration menu - View commit details
-
Copy full SHA for 05583f8 - Browse repository at this point
Copy the full SHA 05583f8View commit details -
Configuration menu - View commit details
-
Copy full SHA for 44b2b40 - Browse repository at this point
Copy the full SHA 44b2b40View commit details -
Configuration menu - View commit details
-
Copy full SHA for b6c60be - Browse repository at this point
Copy the full SHA b6c60beView commit details -
Configuration menu - View commit details
-
Copy full SHA for 4da6d8c - Browse repository at this point
Copy the full SHA 4da6d8cView commit details -
Fix sorting issues of the editor wide diagnostics and apply diagnosti…
…cs related review suggestions Co-authored-by: Pascal Kuthe <pascal.kuthe@semimod.de>
Configuration menu - View commit details
-
Copy full SHA for f9b0865 - Browse repository at this point
Copy the full SHA f9b0865View commit details -
Simplify Display implementation of LanguageServerFeature
Co-authored-by: Ivan Tham <pickfire@riseup.net>
Configuration menu - View commit details
-
Copy full SHA for 19f88fc - Browse repository at this point
Copy the full SHA 19f88fcView commit details -
Fix error messages when no language server is available
Co-authored-by: Skyler Hawthorne <skyler@dead10ck.com>
Configuration menu - View commit details
-
Copy full SHA for dd2f747 - Browse repository at this point
Copy the full SHA dd2f747View commit details -
Use DoubleEndedIterator instead of collect to Vec for reversing
Co-authored-by: Pascal Kuthe <pascal.kuthe@semimod.de>
Configuration menu - View commit details
-
Copy full SHA for 0637691 - Browse repository at this point
Copy the full SHA 0637691View commit details -
Refactored doc.language_servers and doc.language_servers_with_feature…
… to return an iterator and refactor LanguageServerFeature handling to a HashMap (language server name maps to features) Co-authored-by: Pascal Kuthe <pascal.kuthe@semimod.de>
Configuration menu - View commit details
-
Copy full SHA for 76b5cab - Browse repository at this point
Copy the full SHA 76b5cabView commit details -
Configuration menu - View commit details
-
Copy full SHA for ec2f909 - Browse repository at this point
Copy the full SHA ec2f909View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1122928 - Browse repository at this point
Copy the full SHA 1122928View commit details -
Refactor doc.shown_diagnostics to avoid an extra HashSet
Co-authored-by: Pascal Kuthe <pascal.kuthe@semimod.de>
Configuration menu - View commit details
-
Copy full SHA for 9639f42 - Browse repository at this point
Copy the full SHA 9639f42View commit details -
Configuration menu - View commit details
-
Copy full SHA for d963050 - Browse repository at this point
Copy the full SHA d963050View commit details -
Configuration menu - View commit details
-
Copy full SHA for 60a6af1 - Browse repository at this point
Copy the full SHA 60a6af1View commit details -
Configuration menu - View commit details
-
Copy full SHA for 7d20740 - Browse repository at this point
Copy the full SHA 7d20740View commit details -
Configuration menu - View commit details
-
Copy full SHA for 58c913c - Browse repository at this point
Copy the full SHA 58c913cView commit details -
Configuration menu - View commit details
-
Copy full SHA for b1199c5 - Browse repository at this point
Copy the full SHA b1199c5View commit details -
Refactor doc language servers to a HashMap, and the config to use a V…
…ec to retain order
Configuration menu - View commit details
-
Copy full SHA for 2eeac10 - Browse repository at this point
Copy the full SHA 2eeac10View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1d5d5da - Browse repository at this point
Copy the full SHA 1d5d5daView commit details -
Use let else instead of variable and fix some error messages
Co-authored-by: Pascal Kuthe <pascal.kuthe@semimod.de>
Configuration menu - View commit details
-
Copy full SHA for 8ab6d7b - Browse repository at this point
Copy the full SHA 8ab6d7bView commit details -
Configuration menu - View commit details
-
Copy full SHA for 8ee5999 - Browse repository at this point
Copy the full SHA 8ee5999View commit details -
Filter out already seen language servers in requests that can be sent…
… to multiple language servers (code-action, completion, symbol pickers)
Configuration menu - View commit details
-
Copy full SHA for 451fe52 - Browse repository at this point
Copy the full SHA 451fe52View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9d089c2 - Browse repository at this point
Copy the full SHA 9d089c2View commit details -
Filter language servers also by capabilities in `doc.language_servers…
…_with_feature` * Add `helix_lsp::client::Client::supports_feature(&self, LanguageServerFeature)` * Extend `doc.language_servers_with_feature` to use this method as filter as well * Add macro `language_server_with_feature!` to reduce boilerplate for non-mergeable language server requests (like goto-definition) * Refactored most of the `find_map` code to use the either the macro or filter directly via `doc.language_servers_with_feature`
Configuration menu - View commit details
-
Copy full SHA for ff26208 - Browse repository at this point
Copy the full SHA ff26208View commit details -
Configuration menu - View commit details
-
Copy full SHA for 073000e - Browse repository at this point
Copy the full SHA 073000eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 93fd79a - Browse repository at this point
Copy the full SHA 93fd79aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 2a21b93 - Browse repository at this point
Copy the full SHA 2a21b93View commit details -
Fix lsp_restart across multiple different document scopes (language s…
…ervers weren't restarted, if not of the same scope id), and fix some smaller rebase issues
Configuration menu - View commit details
-
Copy full SHA for 3e4bac1 - Browse repository at this point
Copy the full SHA 3e4bac1View commit details -
Reduce boilerplate by 'use lsp::*' in Client::supports_feature, and r…
…emove TODO comment
Configuration menu - View commit details
-
Copy full SHA for 5674850 - Browse repository at this point
Copy the full SHA 5674850View commit details -
Configuration menu - View commit details
-
Copy full SHA for dcb0767 - Browse repository at this point
Copy the full SHA dcb0767View commit details -
Remove TODO comment in helix_lsp::Registry::restart and add doc-comme…
…nt on top of function instead
Configuration menu - View commit details
-
Copy full SHA for 521cdec - Browse repository at this point
Copy the full SHA 521cdecView commit details -
Add function
Editor::language_server_by_id
and refactor/simplify re……lated code, also don't 'crash' in completion menu if language_server somehow disappeared
Configuration menu - View commit details
-
Copy full SHA for 39b9a4b - Browse repository at this point
Copy the full SHA 39b9a4bView commit details -
Some minor clarity/cosmetic improvements
Co-authored-by: Pascal Kuthe <pascal.kuthe@semimod.de>
Configuration menu - View commit details
-
Copy full SHA for 2b746ea - Browse repository at this point
Copy the full SHA 2b746eaView commit details -
Simplify gutter diagnostics rendering by using partition_point instea…
…d of binary search Co-authored-by: Pascal Kuthe <pascal.kuthe@semimod.de>
Configuration menu - View commit details
-
Copy full SHA for 656ee24 - Browse repository at this point
Copy the full SHA 656ee24View commit details -
Apply all review suggestions (doc_id -> id, error message, unnecessar…
…y if) Co-authored-by: Pascal Kuthe <pascal.kuthe@semimod.de>
Configuration menu - View commit details
-
Copy full SHA for f45bbf1 - Browse repository at this point
Copy the full SHA f45bbf1View commit details -
Configuration menu - View commit details
-
Copy full SHA for b6d0e26 - Browse repository at this point
Copy the full SHA b6d0e26View commit details -
Clarify language-servers documentation for mergeable LSP features (`d…
…iagnostics`, `code-action`, `completion`, `document-symbols` and `workspace-symbols`)
Configuration menu - View commit details
-
Copy full SHA for f8fa0d8 - Browse repository at this point
Copy the full SHA f8fa0d8View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2a512f7 - Browse repository at this point
Copy the full SHA 2a512f7View commit details