From 71551d395b4e47804df2d8ecea99e34dbbf16157 Mon Sep 17 00:00:00 2001 From: Philipp Mildenberger Date: Mon, 23 May 2022 18:10:48 +0200 Subject: 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. --- book/src/generated/typable-cmd.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'book/src/generated/typable-cmd.md') diff --git a/book/src/generated/typable-cmd.md b/book/src/generated/typable-cmd.md index a775c655..0c377b3b 100644 --- a/book/src/generated/typable-cmd.md +++ b/book/src/generated/typable-cmd.md @@ -50,7 +50,7 @@ | `:reload-all` | Discard changes and reload all documents from the source files. | | `:update`, `:u` | Write changes only if the file has been modified. | | `:lsp-workspace-command` | Open workspace command picker | -| `:lsp-restart` | Restarts the Language Server that is in use by the current doc | +| `:lsp-restart` | Restarts the language servers used by the currently opened file | | `:lsp-stop` | Stops the Language Server that is in use by the current doc | | `:tree-sitter-scopes` | Display tree sitter scopes, primarily for theming and development. | | `:debug-start`, `:dbg` | Start a debug session from a given template with given parameters. | -- cgit v1.2.3-70-g09d2 From 74e21e1b250be884242596cbd7d98b098bb0fd0c Mon Sep 17 00:00:00 2001 From: Philipp Mildenberger Date: Mon, 13 Mar 2023 15:01:11 +0100 Subject: Fix some lints/docgen hints --- book/src/generated/typable-cmd.md | 2 +- helix-term/src/health.rs | 5 +---- helix-view/src/editor.rs | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) (limited to 'book/src/generated/typable-cmd.md') diff --git a/book/src/generated/typable-cmd.md b/book/src/generated/typable-cmd.md index 0c377b3b..cc2e87ea 100644 --- a/book/src/generated/typable-cmd.md +++ b/book/src/generated/typable-cmd.md @@ -50,7 +50,7 @@ | `:reload-all` | Discard changes and reload all documents from the source files. | | `:update`, `:u` | Write changes only if the file has been modified. | | `:lsp-workspace-command` | Open workspace command picker | -| `:lsp-restart` | Restarts the language servers used by the currently opened file | +| `:lsp-restart` | Restarts the language servers used by the current doc | | `:lsp-stop` | Stops the Language Server that is in use by the current doc | | `:tree-sitter-scopes` | Display tree sitter scopes, primarily for theming and development. | | `:debug-start`, `:dbg` | Start a debug session from a given template with given parameters. | diff --git a/helix-term/src/health.rs b/helix-term/src/health.rs index 031f982c..6b9f8517 100644 --- a/helix-term/src/health.rs +++ b/helix-term/src/health.rs @@ -2,10 +2,7 @@ use crossterm::{ style::{Color, Print, Stylize}, tty::IsTty, }; -use helix_core::{ - config::{default_syntax_loader, user_syntax_loader}, - syntax::LanguageServerFeatureConfiguration, -}; +use helix_core::config::{default_syntax_loader, user_syntax_loader}; use helix_loader::grammar::load_runtime_file; use helix_view::clipboard::get_clipboard_provider; use std::io::Write; diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index 5ca9aceb..697d4459 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -689,7 +689,7 @@ pub struct WhitespaceCharacters { impl Default for WhitespaceCharacters { fn default() -> Self { Self { - space: '·', // U+00B7 + space: '·', // U+00B7 nbsp: '⍽', // U+237D tab: '→', // U+2192 newline: '⏎', // U+23CE -- cgit v1.2.3-70-g09d2 From 7d20740b5b2e115e3075251204ee1ff1901166df Mon Sep 17 00:00:00 2001 From: Philipp Mildenberger Date: Sat, 18 Mar 2023 23:41:38 +0100 Subject: Fix docgen and lsp-stop documentation --- book/src/generated/typable-cmd.md | 2 +- helix-term/src/commands/typed.rs | 2 +- xtask/src/docgen.rs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'book/src/generated/typable-cmd.md') diff --git a/book/src/generated/typable-cmd.md b/book/src/generated/typable-cmd.md index cc2e87ea..0f488dc0 100644 --- a/book/src/generated/typable-cmd.md +++ b/book/src/generated/typable-cmd.md @@ -51,7 +51,7 @@ | `:update`, `:u` | Write changes only if the file has been modified. | | `:lsp-workspace-command` | Open workspace command picker | | `:lsp-restart` | Restarts the language servers used by the current doc | -| `:lsp-stop` | Stops the Language Server that is in use by the current doc | +| `:lsp-stop` | Stops the language servers that are used by the current doc | | `:tree-sitter-scopes` | Display tree sitter scopes, primarily for theming and development. | | `:debug-start`, `:dbg` | Start a debug session from a given template with given parameters. | | `:debug-remote`, `:dbg-tcp` | Connect to a debug adapter by TCP address and start a debugging session from a given template with given parameters. | diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index 38058ed5..5f94b7c4 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -2635,7 +2635,7 @@ pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[ TypableCommand { name: "lsp-stop", aliases: &[], - doc: "Stops the Language Server that is in use by the current doc", + doc: "Stops the language servers that are used by the current doc", fun: lsp_stop, signature: CommandSignature::none(), }, diff --git a/xtask/src/docgen.rs b/xtask/src/docgen.rs index 3bd0592e..d360b4bd 100644 --- a/xtask/src/docgen.rs +++ b/xtask/src/docgen.rs @@ -97,8 +97,8 @@ pub fn lang_features() -> Result { } row.push( lc.language_servers - .iter() - .filter_map(|ls| config.language_server.get(ls.name())) + .keys() + .filter_map(|ls| config.language_server.get(ls)) .map(|s| md_mono(&s.command.clone())) .collect::>() .join(", "), -- cgit v1.2.3-70-g09d2