diff options
| author | Zuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian> | 2026-01-20 12:51:23 +0000 |
|---|---|---|
| committer | Zuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian> | 2026-01-20 12:51:23 +0000 |
| commit | b106fe19b55e9fe3348b3a5c9992c21dac27b02c (patch) | |
| tree | 32663c9a791b7f45ce9bc61c5a87351d5dc2c782 /src/lsp/lsp_project.h | |
| parent | e5d8c4219cfe5629a3ce4dbff01406a1817a788f (diff) | |
Working a bit on the LSP + fixed some bugs
Diffstat (limited to 'src/lsp/lsp_project.h')
| -rw-r--r-- | src/lsp/lsp_project.h | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/src/lsp/lsp_project.h b/src/lsp/lsp_project.h new file mode 100644 index 0000000..9b4fe42 --- /dev/null +++ b/src/lsp/lsp_project.h @@ -0,0 +1,59 @@ +#ifndef LSP_PROJECT_H +#define LSP_PROJECT_H + +#include "parser.h" +#include "lsp_index.h" + +typedef struct ProjectFile +{ + char *path; // Absolute path + char *uri; // file:// URI + char *source; // Cached source content + LSPIndex *index; // File-specific index (local vars, refs) + struct ProjectFile *next; +} ProjectFile; + +typedef struct +{ + // Global symbol table (Structs, Functions, Globals) + // We reuse ParserContext for this, as it already supports registries. + ParserContext *ctx; + + // List of tracked files + ProjectFile *files; + + // Root directory + char *root_path; +} LSPProject; + +// Global project instance +extern LSPProject *g_project; + +// Initialize the project with a root directory +void lsp_project_init(const char *root_path); + +// Find a file in the project +ProjectFile *lsp_project_get_file(const char *uri); + +// Update a file (re-parse and re-index) +void lsp_project_update_file(const char *uri, const char *src); + +// Find definition globally +typedef struct +{ + char *uri; + LSPRange *range; +} DefinitionResult; + +DefinitionResult lsp_project_find_definition(const char *name); + +typedef struct ReferenceResult +{ + char *uri; + LSPRange *range; + struct ReferenceResult *next; +} ReferenceResult; + +ReferenceResult *lsp_project_find_references(const char *name); + +#endif |
