diff options
-rw-r--r-- | buffer.c | 9 | ||||
-rw-r--r-- | config.c | 1 | ||||
-rw-r--r-- | ted-internal.h | 1 |
3 files changed, 11 insertions, 0 deletions
@@ -3315,6 +3315,11 @@ void buffer_render(TextBuffer *buffer, Rect r) { float render_start_y = y1 - (float)(buffer->scroll_y - start_line) * char_height; // where the 1st line is rendered + + if (!settings->show_diagnostics) { + buffer_diagnostics_clear(buffer); + } + const Diagnostic *hover_diagnostic = NULL; // line numbering if (!buffer->is_line_buffer && settings->line_numbers) { @@ -3882,7 +3887,11 @@ static int diagnostic_cmp(const void *av, const void *bv) { } void buffer_publish_diagnostics(TextBuffer *buffer, const LSPRequest *request, LSPDiagnostic *diagnostics) { + const Settings *settings = buffer_settings(buffer); buffer_diagnostics_clear(buffer); + if (!settings->show_diagnostics) { + return; + } arr_foreach_ptr(diagnostics, const LSPDiagnostic, diagnostic) { Diagnostic *d = arr_addp(buffer->diagnostics); d->pos = buffer_pos_from_lsp(buffer, diagnostic->range.start); @@ -122,6 +122,7 @@ static const SettingBool settings_bool[] = { {"crlf-windows", &settings_zero.crlf_windows, true}, {"jump-to-build-error", &settings_zero.jump_to_build_error, true}, {"force-monospace", &settings_zero.force_monospace, true}, + {"show-diagnostics", &settings_zero.show_diagnostics, true}, }; static const SettingU8 settings_u8[] = { {"tab-width", &settings_zero.tab_width, 1, 100, true}, diff --git a/ted-internal.h b/ted-internal.h index e5b9874..42592fb 100644 --- a/ted-internal.h +++ b/ted-internal.h @@ -135,6 +135,7 @@ struct Settings { bool crlf_windows; bool jump_to_build_error; bool force_monospace; + bool show_diagnostics; KeyCombo hover_key; KeyCombo highlight_key; u8 tab_width; |