From 5370505f95b2539ab979e1daddae4a3b843f8d62 Mon Sep 17 00:00:00 2001 From: pommicket Date: Mon, 11 Sep 2023 22:21:18 -0400 Subject: clear diagnostics if buffer_lsp becomes NULL --- buffer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/buffer.c b/buffer.c index c9ab249..0bfafb6 100644 --- a/buffer.c +++ b/buffer.c @@ -3380,7 +3380,7 @@ bool buffer_cursor_move_to_matching_bracket(TextBuffer *buffer) { void buffer_render(TextBuffer *buffer, Rect r) { const Settings *settings = buffer_settings(buffer); - buffer_lsp(buffer); // this will send didOpen/didClose if the buffer's LSP changed + LSP *lsp = buffer_lsp(buffer); // this will send didOpen/didClose if the buffer's LSP changed if (r.size.x < 1 || r.size.y < 1) { // rectangle less than 1 pixel @@ -3421,7 +3421,7 @@ 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) { + if (!settings->show_diagnostics || !lsp) { buffer_diagnostics_clear(buffer); } -- cgit v1.2.3