diff options
author | pommicket <pommicket@gmail.com> | 2025-09-29 15:11:47 -0400 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2025-09-29 15:29:51 -0400 |
commit | 84da626a18ccc779aef4a178ee0097a93c959520 (patch) | |
tree | ea862eff35309f2cae3a0ab30112fb38647eafa2 /buffer.c | |
parent | 16b5baf3083c982220e9feb561f2f53f1720fe2a (diff) |
Send over diagnostics; this fixes code actions
Diffstat (limited to 'buffer.c')
-rw-r--r-- | buffer.c | 15 |
1 files changed, 7 insertions, 8 deletions
@@ -39,14 +39,6 @@ struct BufferEdit { double time; // time at start of edit (i.e. the time just before the edit), in seconds since epoch }; -typedef struct { - MessageType severity; - BufferPos pos; - char *message; - // may be NULL - char *url; -} Diagnostic; - struct TextBuffer { /// NULL if this buffer is untitled or doesn't correspond to a file (e.g. line buffers) char *path; @@ -1004,6 +996,7 @@ static void buffer_line_free(Line *line) { static void diagnostic_free(Diagnostic *diagnostic) { free(diagnostic->message); free(diagnostic->url); + free(diagnostic->raw); memset(diagnostic, 0, sizeof *diagnostic); } @@ -4245,7 +4238,9 @@ void buffer_publish_diagnostics(TextBuffer *buffer, const LSPRequest *request, L arr_foreach_ptr(diagnostics, const LSPDiagnostic, diagnostic) { Diagnostic *d = arr_addp(buffer->diagnostics); d->pos = buffer_pos_from_lsp(buffer, diagnostic->range.start); + d->end = buffer_pos_from_lsp(buffer, diagnostic->range.end); d->severity = diagnostic_severity(diagnostic); + d->raw = str_dup(lsp_request_string(request, diagnostic->raw)); char message[280]; const char *code = lsp_request_string(request, diagnostic->code); if (*code) { @@ -4287,3 +4282,7 @@ void buffer_set_inotify_modified(TextBuffer *buffer) { buffer->inotify_modified = true; } #endif + +const Diagnostic *buffer_diagnostics(TextBuffer *buffer) { + return buffer->diagnostics; +} |