From 4459b8b3aa9d73895391785a99dcc87134e80601 Mon Sep 17 00:00:00 2001 From: Albert Cervin Date: Tue, 17 Sep 2024 08:47:03 +0200 Subject: More lsp support This makes the LSP support complete for now: - Completion - Diagnostics - Goto implementation/declaration - Rename - Documentation - Find references --- src/dged/buffers.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/dged/buffers.c') diff --git a/src/dged/buffers.c b/src/dged/buffers.c index d20be39..f6d197d 100644 --- a/src/dged/buffers.c +++ b/src/dged/buffers.c @@ -1,5 +1,6 @@ #include "buffers.h" #include "buffer.h" +#include "s8.h" #include #include @@ -112,7 +113,7 @@ struct buffer *buffers_find(struct buffers *buffers, const char *name) { struct buffer *buffers_find_by_filename(struct buffers *buffers, const char *path) { struct buffer_chunk *chunk = buffers->head; - size_t pathlen = strlen(path); + struct s8 needle = s8(path); while (chunk != NULL) { for (uint32_t i = 0; i < buffers->chunk_size; ++i) { if (!chunk->entries[i].occupied) { @@ -124,8 +125,8 @@ struct buffer *buffers_find_by_filename(struct buffers *buffers, continue; } - size_t bnamelen = strlen(b->filename); - if (bnamelen == pathlen && memcmp(path, b->filename, bnamelen) == 0) { + struct s8 bname = s8(b->filename); + if (s8endswith(bname, needle)) { return b; } } -- cgit v1.2.3