From 491a44bdf18083d0ee2f19cf39fb8f59f04baf88 Mon Sep 17 00:00:00 2001 From: Gokul Soumya Date: Sat, 26 Mar 2022 20:11:33 +0530 Subject: [PATCH] Move top level lsp config to editor.lsp This is mainly done to accomodate the new lsp.signature-help config option that will be introduced in https://github.com/helix-editor/helix/pull/1755 which will have to be accessed by commands. The top level config struct is split and moved to different places, making the relocation necessary --- book/src/configuration.md | 18 ++++++++---------- helix-term/src/application.rs | 2 +- helix-term/src/config.rs | 8 -------- helix-view/src/editor.rs | 8 ++++++++ 4 files changed, 17 insertions(+), 19 deletions(-) diff --git a/book/src/configuration.md b/book/src/configuration.md index 2b29379eacda9..0a646c496619d 100644 --- a/book/src/configuration.md +++ b/book/src/configuration.md @@ -43,6 +43,14 @@ hidden = false | `auto-info` | Whether to display infoboxes | `true` | | `true-color` | Set to `true` to override automatic detection of terminal truecolor support in the event of a false negative. | `false` | +### `[editor.lsp]` Section + +| Key | Description | Default | +| --- | ----------- | ------- | +| `display-messages` | Display LSP progress messages below statusline[^1] | `false` | + +[^1]: A progress spinner is always shown in the statusline beside the file path. + ### `[editor.cursor-shape]` Section Defines the shape of cursor in each mode. Note that due to limitations @@ -126,13 +134,3 @@ Search specific options. |--|--|---------| | `smart-case` | Enable smart case regex searching (case insensitive unless pattern contains upper case characters) | `true` | | `wrap-around`| Whether the search should wrap after depleting the matches | `true` | - - -## LSP - -To display all language server messages in the status line add the following to your `config.toml`: - -```toml -[lsp] -display-messages = true -``` diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs index 269ce13d15a8f..241d687537cae 100644 --- a/helix-term/src/application.rs +++ b/helix-term/src/application.rs @@ -700,7 +700,7 @@ impl Application { self.lsp_progress.update(server_id, token, work); } - if self.config.lsp.display_messages { + if self.config.editor.lsp.display_messages { self.editor.set_status(status); } } diff --git a/helix-term/src/config.rs b/helix-term/src/config.rs index 1c6289ec8804a..d16dc2ca7308d 100644 --- a/helix-term/src/config.rs +++ b/helix-term/src/config.rs @@ -7,19 +7,11 @@ use crate::keymap::Keymaps; pub struct Config { pub theme: Option, #[serde(default)] - pub lsp: LspConfig, - #[serde(default)] pub keys: Keymaps, #[serde(default)] pub editor: helix_view::editor::Config, } -#[derive(Debug, Default, Clone, PartialEq, Deserialize)] -#[serde(rename_all = "kebab-case", deny_unknown_fields)] -pub struct LspConfig { - pub display_messages: bool, -} - #[cfg(test)] mod tests { use super::*; diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index adf0cdf335a70..4dc48e4f6b4da 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -139,6 +139,13 @@ pub struct Config { /// Search configuration. #[serde(default)] pub search: SearchConfig, + pub lsp: LspConfig, +} + +#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "kebab-case", deny_unknown_fields)] +pub struct LspConfig { + pub display_messages: bool, } #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] @@ -249,6 +256,7 @@ impl Default for Config { cursor_shape: CursorShapeConfig::default(), true_color: false, search: SearchConfig::default(), + lsp: LspConfig::default(), } } }