From bbe75ba8c590747e7df7664128afdf96aeb539e2 Mon Sep 17 00:00:00 2001 From: pommicket Date: Sat, 7 Dec 2024 20:38:11 -0500 Subject: Better handling of LSP errors --- ide-highlights.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'ide-highlights.c') diff --git a/ide-highlights.c b/ide-highlights.c index b8c3a94..1dc3aff 100644 --- a/ide-highlights.c +++ b/ide-highlights.c @@ -54,6 +54,11 @@ void highlights_process_lsp_response(Ted *ted, const LSPResponse *response) { return; // not a highlight request if (response->request.id != hls->last_request.id) return; // old request + hls->last_request.id = 0; + if (lsp_response_is_error(response)) { + highlights_close(ted); + return; + } const LSPResponseHighlight *hl_response = &response->data.highlight; arr_set_len(hls->highlights, arr_len(hl_response->highlights)); // type-safe memcpy -- cgit v1.2.3