on master help sign in
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

commit7b3a3d562cb46a1d70950983d460e388ae46cf79 authorGokul Soumya <gokulps15@gmail.com> dateMon 28 Mar 2022, 06:41 (5 years ago) parentbee05dd
4 files changed+17−20
book/src/configuration.md+8−10 helix-term/src/application.rs+1−1 helix-term/src/config.rs−9 helix-view/src/editor.rs+8
book/src/configuration.md+8−10
@@ -43,6 +43,14 @@ hidden = false
4343| `auto-info` | Whether to display infoboxes | `true` |
4444| `true-color` | Set to `true` to override automatic detection of terminal truecolor support in the event of a false negative. | `false` |
4545
46+### `[editor.lsp]` Section
47+
48+| Key | Description | Default |
49+| --- | ----------- | ------- |
50+| `display-messages` | Display LSP progress messages below statusline[^1] | `false` |
51+
52+[^1]: A progress spinner is always shown in the statusline beside the file path.
53+
4654### `[editor.cursor-shape]` Section
4755
4856Defines the shape of cursor in each mode. Note that due to limitations
@@ -126,13 +134,3 @@ Search specific options.
126134|--|--|---------|
127135| `smart-case` | Enable smart case regex searching (case insensitive unless pattern contains upper case characters) | `true` |
128136| `wrap-around`| Whether the search should wrap after depleting the matches | `true` |
129−
130−
131−## LSP
132−
133−To display all language server messages in the status line add the following to your `config.toml`:
134−
135−```toml
136−[lsp]
137−display-messages = true
138−```
helix-term/src/application.rs+1−1
@@ -760,7 +760,7 @@ impl Application {
760760 self.lsp_progress.update(server_id, token, work);
761761 }
762762
763− if self.config.load().lsp.display_messages {
763+ if self.config.load().editor.lsp.display_messages {
764764 self.editor.set_status(status);
765765 }
766766 }
helix-term/src/config.rs−9
@@ -11,8 +11,6 @@ use toml::de::Error as TomlError;
1111#[serde(deny_unknown_fields)]
1212pub struct Config {
1313 pub theme: Option<String>,
14− #[serde(default)]
15− pub lsp: LspConfig,
1614 #[serde(default = "default")]
1715 pub keys: HashMap<Mode, Keymap>,
1816 #[serde(default)]
@@ -23,7 +21,6 @@ impl Default for Config {
2321 fn default() -> Config {
2422 Config {
2523 theme: None,
26− lsp: LspConfig::default(),
2724 keys: default(),
2825 editor: helix_view::editor::Config::default(),
2926 }
@@ -45,12 +42,6 @@ impl Display for ConfigLoadError {
4542 }
4643}
4744
48−#[derive(Debug, Default, Clone, PartialEq, Deserialize)]
49−#[serde(rename_all = "kebab-case", deny_unknown_fields)]
50−pub struct LspConfig {
51− pub display_messages: bool,
52−}
53−
5445impl Config {
5546 pub fn load(config_path: PathBuf) -> Result<Config, ConfigLoadError> {
5647 match std::fs::read_to_string(config_path) {
helix-view/src/editor.rs+8
@@ -143,6 +143,13 @@ pub struct Config {
143143 /// Search configuration.
144144 #[serde(default)]
145145 pub search: SearchConfig,
146+ pub lsp: LspConfig,
147+}
148+
149+#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)]
150+#[serde(rename_all = "kebab-case", deny_unknown_fields)]
151+pub struct LspConfig {
152+ pub display_messages: bool,
146153}
147154
148155#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
@@ -253,6 +260,7 @@ impl Default for Config {
253260 cursor_shape: CursorShapeConfig::default(),
254261 true_color: false,
255262 search: SearchConfig::default(),
263+ lsp: LspConfig::default(),
256264 }
257265 }
258266}