summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2023-09-11 22:21:18 -0400
committerpommicket <pommicket@gmail.com>2023-09-11 22:21:18 -0400
commit5370505f95b2539ab979e1daddae4a3b843f8d62 (patch)
tree3d5967f4d709c43047d4c9682dbbc542b2da5006
parent9abc5c5602a0611f8d8dca4fd706bab9aa3e4fa4 (diff)
clear diagnostics if buffer_lsp becomes NULL
-rw-r--r--buffer.c4
1 files 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);
}