diff --git a/book/src/configuration.md b/book/src/configuration.md index f110edd7c..9036b5018 100644 --- a/book/src/configuration.md +++ b/book/src/configuration.md @@ -43,6 +43,14 @@ ### `[editor]` Section | `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 @@ ### `[editor.search]` Section |--|--|---------| | `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 9b21c2a04..6f90ae61e 100644 --- a/helix-term/src/application.rs +++ b/helix-term/src/application.rs @@ -760,7 +760,7 @@ pub async fn handle_language_server_message( self.lsp_progress.update(server_id, token, work); } - if self.config.load().lsp.display_messages { + if self.config.load().editor.lsp.display_messages { self.editor.set_status(status); } } diff --git a/helix-term/src/config.rs b/helix-term/src/config.rs index 06e44ad92..4407a882f 100644 --- a/helix-term/src/config.rs +++ b/helix-term/src/config.rs @@ -11,8 +11,6 @@ #[serde(deny_unknown_fields)] pub struct Config { pub theme: Option, - #[serde(default)] - pub lsp: LspConfig, #[serde(default = "default")] pub keys: HashMap, #[serde(default)] @@ -23,7 +21,6 @@ impl Default for Config { fn default() -> Config { Config { theme: None, - lsp: LspConfig::default(), keys: default(), editor: helix_view::editor::Config::default(), } @@ -45,12 +42,6 @@ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { } } -#[derive(Debug, Default, Clone, PartialEq, Deserialize)] -#[serde(rename_all = "kebab-case", deny_unknown_fields)] -pub struct LspConfig { - pub display_messages: bool, -} - impl Config { pub fn load(config_path: PathBuf) -> Result { match std::fs::read_to_string(config_path) { diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index 8220deb7f..9a2b4297f 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -143,6 +143,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)] @@ -253,6 +260,7 @@ fn default() -> Self { cursor_shape: CursorShapeConfig::default(), true_color: false, search: SearchConfig::default(), + lsp: LspConfig::default(), } } }