diff options
| author | Zuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian> | 2026-01-26 02:23:19 +0000 |
|---|---|---|
| committer | Zuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian> | 2026-01-26 02:23:19 +0000 |
| commit | 894e4c69cc10242fc49bcaadf76b672607867d67 (patch) | |
| tree | 426fa1ae0d21594e9f44a0db153c182eadf46cbd /src/lsp | |
| parent | 98cc55d6fce0327b35030e167e2bc9411321737e (diff) | |
Improved doxygen docs
Diffstat (limited to 'src/lsp')
| -rw-r--r-- | src/lsp/json_rpc.h | 9 | ||||
| -rw-r--r-- | src/lsp/lsp_index.h | 35 | ||||
| -rw-r--r-- | src/lsp/lsp_project.h | 27 |
3 files changed, 46 insertions, 25 deletions
diff --git a/src/lsp/json_rpc.h b/src/lsp/json_rpc.h index 363f425..98d7ec1 100644 --- a/src/lsp/json_rpc.h +++ b/src/lsp/json_rpc.h @@ -2,7 +2,14 @@ #ifndef JSON_RPC_H #define JSON_RPC_H -// Yeah, just this lol. +/** + * @brief Handle a raw JSON-RPC request string. + * + * Parses the request, routes it to the appropriate handler (initialize, textDocument/didChange, etc.), + * and sends back the response to stdout. + * + * @param json_str Null-terminated JSON request string. + */ void handle_request(const char *json_str); #endif diff --git a/src/lsp/lsp_index.h b/src/lsp/lsp_index.h index f4aaf96..1b45c57 100644 --- a/src/lsp/lsp_index.h +++ b/src/lsp/lsp_index.h @@ -4,30 +4,39 @@ #include "parser.h" +/** + * @brief Type of an indexed AST range. + */ typedef enum { - RANGE_DEFINITION, - RANGE_REFERENCE + RANGE_DEFINITION, ///< Defines a symbol. + RANGE_REFERENCE ///< References a symbol. } RangeType; +/** + * @brief A range in the source code mapping to semantic info. + */ typedef struct LSPRange { - int start_line; - int start_col; - int end_line; - int end_col; // Approximation. - RangeType type; - int def_line; - int def_col; - char *hover_text; - ASTNode *node; + int start_line; ///< Start line (1-based). + int start_col; ///< Start column (1-based). + int end_line; ///< End line. + int end_col; ///< End column (approximated). + RangeType type; ///< Type of range (def or ref). + int def_line; ///< Line of definition (if reference). + int def_col; ///< Column of definition (if reference). + char *hover_text; ///< Tooltip text / signature. + ASTNode *node; ///< Associated AST node. struct LSPRange *next; } LSPRange; +/** + * @brief Index of a single file. + */ typedef struct LSPIndex { - LSPRange *head; - LSPRange *tail; + LSPRange *head; ///< First range in the file. + LSPRange *tail; ///< Last range in the file. } LSPIndex; // API. diff --git a/src/lsp/lsp_project.h b/src/lsp/lsp_project.h index 9b4fe42..f6d6942 100644 --- a/src/lsp/lsp_project.h +++ b/src/lsp/lsp_project.h @@ -4,26 +4,31 @@ #include "parser.h" #include "lsp_index.h" +/** + * @brief Represents a tracked file in the LSP project. + */ typedef struct ProjectFile { - char *path; // Absolute path - char *uri; // file:// URI - char *source; // Cached source content - LSPIndex *index; // File-specific index (local vars, refs) + char *path; ///< Absolute file path. + char *uri; ///< file:// URI. + char *source; ///< Cached source content (in-memory). + LSPIndex *index; ///< File-specific symbol index. struct ProjectFile *next; } ProjectFile; +/** + * @brief Global state for the Language Server Project. + */ typedef struct { - // Global symbol table (Structs, Functions, Globals) - // We reuse ParserContext for this, as it already supports registries. + /** + * @brief Global shared parser context. + * Contains global registries (structs, functions) reused across files. + */ ParserContext *ctx; - // List of tracked files - ProjectFile *files; - - // Root directory - char *root_path; + ProjectFile *files; ///< List of tracked open files. + char *root_path; ///< Project root directory. } LSPProject; // Global project instance |
