summaryrefslogtreecommitdiff
path: root/buffer.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2023-09-07 19:44:44 -0400
committerpommicket <pommicket@gmail.com>2023-09-07 22:50:12 -0400
commitb8be8dd9239f1b08cb578539e634de73751fbad8 (patch)
tree4755c313f6fcdf4e6cd0d08329fc7b2b5fda26ec /buffer.c
parent7963435fc83e9963a59ea8eae234339c8c97be9c (diff)
add show-diagnostics setting
Diffstat (limited to 'buffer.c')
-rw-r--r--buffer.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/buffer.c b/buffer.c
index 19c14a5..7c0e481 100644
--- a/buffer.c
+++ b/buffer.c
@@ -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);