summaryrefslogtreecommitdiff
path: root/lsp.h
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2022-12-30 15:27:38 -0500
committerpommicket <pommicket@gmail.com>2022-12-30 15:27:38 -0500
commitd51f4ce90fc40bb6b1813e7716d1db40cf91ee15 (patch)
treedbd72d0add72d4923244e93e476deeb422b0ff99 /lsp.h
parent547bfbba7a1ef84d397711882a501fc4914addba (diff)
cancelling requests
Diffstat (limited to 'lsp.h')
-rw-r--r--lsp.h25
1 files changed, 24 insertions, 1 deletions
diff --git a/lsp.h b/lsp.h
index 90f70d7..5d5f3c4 100644
--- a/lsp.h
+++ b/lsp.h
@@ -38,6 +38,7 @@ typedef enum {
// client-to-server
LSP_REQUEST_INITIALIZE, // initialize
LSP_REQUEST_INITIALIZED, // initialized
+ LSP_REQUEST_CANCEL, // $/cancelRequest
// workspace/didChangeConfiguration with parameters specifically for jdtls.
// we need this because annoyingly jdtls refuses to give signature help
// unless you specifically configure it to do that
@@ -60,6 +61,24 @@ typedef enum {
LSP_REQUEST_WORKSPACE_FOLDERS, // workspace/workspaceFolders - NOTE: this is handled directly in lsp-parse.c (because it only needs information from the LSP struct)
} LSPRequestType;
+typedef enum {
+ LSP_ERROR_PARSE = -32700,
+ LSP_ERROR_INVALID_REQUEST = -32600,
+ LSP_ERROR_METHOD_NOT_FOUND = -32601,
+ LSP_ERROR_INVALID_PARAMS = -32602,
+ LSP_ERROR_INTERNAL = -32603,
+ LSP_ERROR_SERVER_NOT_INITIALIZED = -32002,
+ LSP_ERROR_UNKNOWN_CODE = -32001,
+ LSP_ERROR_REQUEST_FAILED = -32803,
+ LSP_ERROR_SERVER_CANCELLED = -32802,
+ LSP_ERROR_CONTENT_MODIFIED = -32801,
+ LSP_ERROR_REQUEST_CANCELLED = -32800,
+} LSPError;
+
+typedef struct {
+ LSPRequestID id;
+} LSPRequestCancel;
+
typedef struct {
Language language;
LSPDocumentID document;
@@ -138,11 +157,12 @@ typedef struct {
} LSPRequestDidChangeWorkspaceFolders;
typedef struct {
- u32 id;
+ LSPRequestID id;
LSPRequestType type;
char *id_string; // if not NULL, this is the ID (only for server-to-client messages; we always use integer IDs)
// one member of this union is set depending on `type`.
union {
+ LSPRequestCancel cancel;
LSPRequestDidOpen open;
LSPRequestDidClose close;
LSPRequestDidChange change;
@@ -427,6 +447,9 @@ const char *lsp_document_path(LSP *lsp, LSPDocumentID id);
// returns the ID of the sent request, or 0 if the request is not supported by the LSP
// don't free the contents of this request (even on failure)! let me handle it!
LSPRequestID lsp_send_request(LSP *lsp, LSPRequest *request);
+// send a $/cancelRequest notification
+// if id = 0, nothing will happen.
+void lsp_cancel_request(LSP *lsp, LSPRequestID id);
// don't free the contents of this response! let me handle it!
void lsp_send_response(LSP *lsp, LSPResponse *response);
const char *lsp_response_string(const LSPResponse *response, LSPString string);