Skip to content

Commit

Permalink
Move top level lsp config to editor.lsp
Browse files Browse the repository at this point in the history
This is mainly done to accomodate the new lsp.signature-help config
option that will be introduced in helix-editor#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
  • Loading branch information
sudormrfbin committed Mar 26, 2022
1 parent 3c79bf5 commit 491a44b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 19 deletions.
18 changes: 8 additions & 10 deletions book/src/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
```
2 changes: 1 addition & 1 deletion helix-term/src/application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down
8 changes: 0 additions & 8 deletions helix-term/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,11 @@ use crate::keymap::Keymaps;
pub struct Config {
pub theme: Option<String>,
#[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::*;
Expand Down
8 changes: 8 additions & 0 deletions helix-view/src/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -249,6 +256,7 @@ impl Default for Config {
cursor_shape: CursorShapeConfig::default(),
true_color: false,
search: SearchConfig::default(),
lsp: LspConfig::default(),
}
}
}
Expand Down

0 comments on commit 491a44b

Please sign in to comment.