summaryrefslogtreecommitdiff
path: root/buffer.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2022-12-22 18:19:02 -0500
committerpommicket <pommicket@gmail.com>2022-12-22 18:19:02 -0500
commit6205e83793eff547d404fa5bde747076a1191893 (patch)
treee6dffd5f6ac53ed43195ccec6f57918dbfd2e7dd /buffer.c
parent23e138019964662b4e847770eeda2bb5d3130f7a (diff)
didClose notification, better completion
Diffstat (limited to 'buffer.c')
-rw-r--r--buffer.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/buffer.c b/buffer.c
index 183341f..19a55f2 100644
--- a/buffer.c
+++ b/buffer.c
@@ -746,6 +746,15 @@ static void buffer_line_free(Line *line) {
// Free a buffer. Once a buffer is freed, you can call buffer_create on it again.
// Does not free the pointer `buffer` (buffer might not have even been allocated with malloc)
void buffer_free(TextBuffer *buffer) {
+ LSP *lsp = buffer_lsp(buffer);
+ if (lsp) {
+ LSPRequest did_close = {.type = LSP_REQUEST_DID_CLOSE};
+ did_close.data.close = (LSPRequestDidClose){
+ .document = lsp_document_id(lsp, buffer->filename)
+ };
+ lsp_send_request(lsp, &did_close);
+ }
+
Line *lines = buffer->lines;
u32 nlines = buffer->nlines;
for (u32 i = 0; i < nlines; ++i) {