summaryrefslogtreecommitdiff
path: root/lsp.h
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2023-09-07 14:38:49 -0400
committerpommicket <pommicket@gmail.com>2023-09-07 14:38:49 -0400
commit815d652b570f53c989f62d0c7db847d7d6dfd940 (patch)
treec977583cfcc5b682a8cee5546bcf3c837014df1b /lsp.h
parentbb4b7774aabc2686f936935b02899b1aa0bf1f2b (diff)
textDocument/publishDiagnostics parsing
Diffstat (limited to 'lsp.h')
-rw-r--r--lsp.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/lsp.h b/lsp.h
index a03256d..1d9d8ee 100644
--- a/lsp.h
+++ b/lsp.h
@@ -94,6 +94,7 @@ typedef enum {
LSP_REQUEST_SHOW_MESSAGE, //< window/showMessage and window/showMessageRequest
LSP_REQUEST_LOG_MESSAGE, //< window/logMessage
LSP_REQUEST_WORKSPACE_FOLDERS, //< workspace/workspaceFolders - NOTE: this is handled directly in lsp-parse.c (because it only needs information from the LSP struct)
+ LSP_REQUEST_PUBLISH_DIAGNOSTICS, //< textDocument/publishDiagnostics
} LSPRequestType;
typedef enum {
@@ -148,6 +149,30 @@ typedef struct {
LSPString message;
} LSPRequestMessage;
+typedef enum {
+#define LSP_DIAGNOSTIC_SEVERITY_MIN 1
+ LSP_DIAGNOSTIC_SEVERITY_ERROR = 1,
+ LSP_DIAGNOSTIC_SEVERITY_WARNING = 2,
+ LSP_DIAGNOSTIC_SEVERITY_INFORMATION = 3,
+ LSP_DIAGNOSTIC_SEVERITY_HINT = 4,
+#define LSP_DIAGNOSTIC_SEVERITY_MAX 4
+} LSPDiagnosticSeverity;
+
+typedef struct {
+ LSPRange range;
+ LSPDiagnosticSeverity severity;
+ LSPString code;
+ LSPString message;
+ /// URI to description of code
+ /// e.g. for Rust's E0621, this would be https://doc.rust-lang.org/error_codes/E0621.html
+ LSPString code_description_uri;
+} LSPDiagnostic;
+
+typedef struct {
+ LSPDocumentID document;
+ LSPDiagnostic *diagnostics; // dynamic array
+} LSPRequestPublishDiagnostics;
+
/// these triggers are used for completion context and signature help context.
#define LSP_TRIGGER_NONE 0 // not actually defined in LSP spec
@@ -247,6 +272,7 @@ typedef struct {
LSPRequestDidChangeWorkspaceFolders change_workspace_folders;
LSPRequestRename rename;
LSPRequestDocumentLink document_link;
+ LSPRequestPublishDiagnostics publish_diagnostics;
} data;
} LSPRequest;