feat: complete implementation for toggle diagnostics option

This commit is contained in:
Nikita Revenco 2024-12-09 14:18:17 +00:00
parent be3dea5468
commit 069ca339a6
4 changed files with 3 additions and 7 deletions

View file

@ -53,6 +53,7 @@
| `popup-border` | Draw border around `popup`, `menu`, `all`, or `none` | `none` |
| `indent-heuristic` | How the indentation for a newly inserted line is computed: `simple` just copies the indentation level from the previous line, `tree-sitter` computes the indentation based on the syntax tree and `hybrid` combines both approaches. If the chosen heuristic is not available, a different one will be used as a fallback (the fallback order being `hybrid` -> `tree-sitter` -> `simple`). | `hybrid`
| `jump-label-alphabet` | The characters that are used to generate two character jump labels. Characters at the start of the alphabet are used first. | `"abcdefghijklmnopqrstuvwxyz"`
| `enable-diagnostics` | Whether to show obtrusive diagnostics, such as inline diagnostics and overlay diagnostics | `true` |
| `end-of-line-diagnostics` | Minimum severity of diagnostics to render at the end of the line. Set to `disable` to disable entirely. Refer to the setting about `inline-diagnostics` for more details | "disable"
| `clipboard-provider` | Which API to use for clipboard interaction. One of `pasteboard` (MacOS), `wayland`, `x-clip`, `x-sel`, `win-32-yank`, `termux`, `tmux`, `windows`, `termcode`, `none`, or a custom command set. | Platform and environment specific. |

View file

@ -88,4 +88,3 @@
| `:move`, `:mv` | Move the current buffer and its corresponding file to a different path |
| `:yank-diagnostic` | Yank diagnostic(s) under primary cursor to register, or clipboard by default |
| `:read`, `:r` | Load a file into buffer |
| `:toggle-diagnostics`, `:td` | Toggle Diagnostics |

View file

@ -189,11 +189,8 @@ impl EditorView {
primary_cursor,
});
}
let config = doc.config.load();
// view.diagnostics_handler
// .active
// .set(config.enable_diagnostics);
let config = doc.config.load();
if config.enable_diagnostics {
let width = view.inner_width(doc);
@ -202,7 +199,6 @@ impl EditorView {
.show_cursorline_diagnostics(doc, view.id);
let inline_diagnostic_config =
config.inline_diagnostics.prepare(width, enable_cursor_line);
decorations.add_decoration(InlineDiagnostics::new(
doc,
theme,

View file

@ -106,7 +106,7 @@ impl DiagnosticsHandler {
}
pub fn show_cursorline_diagnostics(&self, doc: &Document, view: ViewId) -> bool {
if !self.active.take() {
if !self.active || !doc.config.load().enable_diagnostics {
return false;
}
let cursor_line = doc