Add an option to disable display of progress in status bar

pull/297/head
wojciechkepka 3 years ago committed by Blaž Hrastnik
parent d095ec15d4
commit bbefc1db63

@ -1,5 +1,12 @@
# Configuration # Configuration
## LSP
To disable language server progress report from being displayed in the status bar add this option to your `config.toml`:
```toml
lsp_progress = false
```
## Theme ## Theme
Use a custom theme by placing a theme.toml in your config directory (i.e ~/.config/helix/theme.toml). The default theme.toml can be found [here](https://github.com/helix-editor/helix/blob/master/theme.toml), and user submitted themes [here](https://github.com/helix-editor/helix/blob/master/contrib/themes). Use a custom theme by placing a theme.toml in your config directory (i.e ~/.config/helix/theme.toml). The default theme.toml can be found [here](https://github.com/helix-editor/helix/blob/master/theme.toml), and user submitted themes [here](https://github.com/helix-editor/helix/blob/master/contrib/themes).
@ -87,3 +94,4 @@ Possible keys:
These keys match [tree-sitter scopes](https://tree-sitter.github.io/tree-sitter/syntax-highlighting#theme). We half-follow the common scopes from [macromates language grammars](https://macromates.com/manual/en/language_grammars) with some differences. These keys match [tree-sitter scopes](https://tree-sitter.github.io/tree-sitter/syntax-highlighting#theme). We half-follow the common scopes from [macromates language grammars](https://macromates.com/manual/en/language_grammars) with some differences.
For a given highlight produced, styling will be determined based on the longest matching theme key. So it's enough to provide function to highlight `function.macro` and `function.builtin` as well, but you can use more specific scopes to highlight specific cases differently. For a given highlight produced, styling will be determined based on the longest matching theme key. So it's enough to provide function to highlight `function.macro` and `function.builtin` as well, but you can use more specific scopes to highlight specific cases differently.

@ -39,6 +39,7 @@ pub struct Application {
callbacks: LspCallbacks, callbacks: LspCallbacks,
lsp_progress: LspProgressMap, lsp_progress: LspProgressMap,
lsp_progress_enabled: bool,
} }
impl Application { impl Application {
@ -77,6 +78,7 @@ impl Application {
callbacks: FuturesUnordered::new(), callbacks: FuturesUnordered::new(),
lsp_progress: LspProgressMap::new(), lsp_progress: LspProgressMap::new(),
lsp_progress_enabled: config.global.lsp_progress,
}; };
Ok(app) Ok(app)
@ -310,9 +312,11 @@ impl Application {
self.lsp_progress.update(server_id, token, work); self.lsp_progress.update(server_id, token, work);
} }
if self.lsp_progress_enabled {
self.editor.set_status(status); self.editor.set_status(status);
self.render(); self.render();
} }
}
_ => unreachable!(), _ => unreachable!(),
} }
} }

@ -5,13 +5,20 @@ use serde::{de::Error as SerdeError, Deserialize, Serialize};
use crate::keymap::{parse_keymaps, Keymaps}; use crate::keymap::{parse_keymaps, Keymaps};
#[derive(Default)]
pub struct GlobalConfig {
pub lsp_progress: bool,
}
#[derive(Default)] #[derive(Default)]
pub struct Config { pub struct Config {
pub global: GlobalConfig,
pub keymaps: Keymaps, pub keymaps: Keymaps,
} }
#[derive(Serialize, Deserialize)] #[derive(Serialize, Deserialize)]
struct TomlConfig { struct TomlConfig {
lsp_progress: Option<bool>,
keys: Option<HashMap<String, HashMap<String, String>>>, keys: Option<HashMap<String, HashMap<String, String>>>,
} }
@ -22,6 +29,9 @@ impl<'de> Deserialize<'de> for Config {
{ {
let config = TomlConfig::deserialize(deserializer)?; let config = TomlConfig::deserialize(deserializer)?;
Ok(Self { Ok(Self {
global: GlobalConfig {
lsp_progress: config.lsp_progress.unwrap_or(true),
},
keymaps: config keymaps: config
.keys .keys
.map(|r| parse_keymaps(&r)) .map(|r| parse_keymaps(&r))

Loading…
Cancel
Save