diff options
| author | Albert Cervin <albert@acervin.com> | 2025-11-21 21:46:18 +0100 |
|---|---|---|
| committer | Albert Cervin <albert@acervin.com> | 2025-11-21 21:46:18 +0100 |
| commit | 3940a20f62baf567cf31e1206adba050b477c9fa (patch) | |
| tree | 4437c6b5ad20b264d3576717923d7f1f5a9c12f5 /src/main/lsp.c | |
| parent | fd5683cdc61efa37a1be7b94901f75c5409d2297 (diff) | |
| download | dged-3940a20f62baf567cf31e1206adba050b477c9fa.tar.gz dged-3940a20f62baf567cf31e1206adba050b477c9fa.tar.xz dged-3940a20f62baf567cf31e1206adba050b477c9fa.zip | |
Fix the yellow on yellow for warnings
Diagnostic highlight now sets the fg to white and the background to
the appropriate color for the diagnostic severity. Before, we
could end up with a yellow color for warning as background and
a yellow as foreground for a function, which caused unreadable text.
Also fix some more cases where re-render is needed.
Diffstat (limited to 'src/main/lsp.c')
| -rw-r--r-- | src/main/lsp.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/main/lsp.c b/src/main/lsp.c index ab9ba39..de7f553 100644 --- a/src/main/lsp.c +++ b/src/main/lsp.c @@ -50,6 +50,7 @@ struct lsp_server { enum position_encoding_kind position_encoding; struct lsp_diagnostics *diagnostics; + layer_id diagnostics_layer_id; struct completion_ctx *completion_ctx; }; @@ -192,6 +193,8 @@ request_response_received(struct lsp_server *server, uint64_t id, static void buffer_updated(struct buffer *buffer, void *userdata) { struct lsp_server *server = (struct lsp_server *)userdata; + buffer_clear_text_property_layer(buffer, server->diagnostics_layer_id); + diagnostic_vec *diagnostics = diagnostics_for_buffer(server->diagnostics, buffer); if (diagnostics == NULL) { @@ -213,7 +216,8 @@ static void buffer_updated(struct buffer *buffer, void *userdata) { struct region reg = region_new( diag->region.begin, buffer_previous_char(buffer, diag->region.end)); - buffer_add_text_property(buffer, reg.begin, reg.end, prop); + buffer_add_text_property_to_layer(buffer, reg.begin, reg.end, prop, + server->diagnostics_layer_id); if (window_buffer(windows_get_active()) == buffer) { struct buffer_view *bv = window_buffer_view(windows_get_active()); @@ -589,6 +593,7 @@ static void create_lsp_client(struct buffer *buffer, void *userdata) { } new->value.diagnostics = diagnostics_create(); + new->value.diagnostics_layer_id = buffer_add_text_property_layer(buffer); // support for this is determined later new->value.completion_ctx = NULL; |
