Move top level lsp config to editor.lsp (#1868)

* 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

* Revert rebase slipup
This commit is contained in:
Gokul Soumya 2022-03-28 06:41:52 +05:30 committed by GitHub
parent bee05dd32a
commit 7b3a3d562c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 20 deletions

View File

@ -43,6 +43,14 @@ ### `[editor]` Section
| `auto-info` | Whether to display infoboxes | `true` | | `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` | | `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 ### `[editor.cursor-shape]` Section
Defines the shape of cursor in each mode. Note that due to limitations 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` | | `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` | | `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
```

View File

@ -760,7 +760,7 @@ pub async fn handle_language_server_message(
self.lsp_progress.update(server_id, token, work); 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); self.editor.set_status(status);
} }
} }

View File

@ -11,8 +11,6 @@
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
pub struct Config { pub struct Config {
pub theme: Option<String>, pub theme: Option<String>,
#[serde(default)]
pub lsp: LspConfig,
#[serde(default = "default")] #[serde(default = "default")]
pub keys: HashMap<Mode, Keymap>, pub keys: HashMap<Mode, Keymap>,
#[serde(default)] #[serde(default)]
@ -23,7 +21,6 @@ impl Default for Config {
fn default() -> Config { fn default() -> Config {
Config { Config {
theme: None, theme: None,
lsp: LspConfig::default(),
keys: default(), keys: default(),
editor: helix_view::editor::Config::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 { impl Config {
pub fn load(config_path: PathBuf) -> Result<Config, ConfigLoadError> { pub fn load(config_path: PathBuf) -> Result<Config, ConfigLoadError> {
match std::fs::read_to_string(config_path) { match std::fs::read_to_string(config_path) {

View File

@ -143,6 +143,13 @@ pub struct Config {
/// Search configuration. /// Search configuration.
#[serde(default)] #[serde(default)]
pub search: SearchConfig, 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)] #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
@ -253,6 +260,7 @@ fn default() -> Self {
cursor_shape: CursorShapeConfig::default(), cursor_shape: CursorShapeConfig::default(),
true_color: false, true_color: false,
search: SearchConfig::default(), search: SearchConfig::default(),
lsp: LspConfig::default(),
} }
} }
} }