summaryrefslogtreecommitdiff
path: root/lsp.h
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2022-12-27 18:28:56 -0500
committerpommicket <pommicket@gmail.com>2022-12-27 18:28:56 -0500
commite112a90ff73f7f407ed2251f905565713c237bc1 (patch)
treefd2cca33161c807cbbf8b29d9a49e778bee5aca8 /lsp.h
parent1eaef3694d54d3d92f0b43304c72f5148b4e5db9 (diff)
start signature help
Diffstat (limited to 'lsp.h')
-rw-r--r--lsp.h28
1 files changed, 21 insertions, 7 deletions
diff --git a/lsp.h b/lsp.h
index 5452dc2..1c75861 100644
--- a/lsp.h
+++ b/lsp.h
@@ -33,6 +33,7 @@ typedef enum {
LSP_REQUEST_DID_CLOSE, // textDocument/didClose
LSP_REQUEST_DID_CHANGE, // textDocument/didChange
LSP_REQUEST_COMPLETION, // textDocument/completion
+ LSP_REQUEST_SIGNATURE_HELP, // textDocument/signatureHelp
LSP_REQUEST_DID_CHANGE_WORKSPACE_FOLDERS, // workspace/didChangeWorkspaceFolders
// server-to-client
@@ -82,12 +83,15 @@ typedef struct {
LSPPosition pos;
} LSPDocumentPosition;
-typedef enum {
- LSP_TRIGGER_NONE = 0, // not actually defined in LSP spec
- LSP_TRIGGER_INVOKED = 1,
- LSP_TRIGGER_CHARACTER = 2,
- LSP_TRIGGER_INCOMPLETE = 3
-} LSPCompletionTriggerKind;
+
+// these triggers are used for completion context and signature help context.
+#define LSP_TRIGGER_NONE 0 // not actually defined in LSP spec
+#define LSP_TRIGGER_INVOKED 1
+#define LSP_TRIGGER_CHARACTER 2
+#define LSP_TRIGGER_INCOMPLETE 3
+#define LSP_TRIGGER_CONTENT_CHANGE 3
+typedef u8 LSPCompletionTriggerKind;
+typedef u8 LSPSignatureHelpTriggerKind;
typedef struct {
LSPCompletionTriggerKind trigger_kind;
@@ -100,6 +104,10 @@ typedef struct {
} LSPRequestCompletion;
typedef struct {
+ LSPDocumentPosition position;
+} LSPRequestSignatureHelp;
+
+typedef struct {
LSPDocumentID *removed; // dynamic array
LSPDocumentID *added; // dynamic array
} LSPRequestDidChangeWorkspaceFolders;
@@ -115,6 +123,7 @@ typedef struct {
LSPRequestDidClose close;
LSPRequestDidChange change;
LSPRequestCompletion completion;
+ LSPRequestSignatureHelp signature_help;
// LSP_REQUEST_SHOW_MESSAGE or LSP_REQUEST_LOG_MESSAGE
LSPRequestMessage message;
LSPRequestDidChangeWorkspaceFolders change_workspace_folders;
@@ -263,6 +272,7 @@ typedef struct {
} LSPDocumentData;
typedef struct {
+ bool signature_help_support;
bool completion_support;
// support for multiple root folders
// sadly, as of me writing this, clangd and rust-analyzer don't support this
@@ -316,7 +326,11 @@ typedef struct LSP {
// never accessed in main thread before `initialized = true`.
LSPCapabilities capabilities;
// thread-safety: same as `capabilities`
- char32_t *trigger_chars; // dynamic array of "trigger characters"
+ char32_t *completion_trigger_chars; // dynamic array
+ // thread-safety: same as `capabilities`
+ char32_t *signature_help_trigger_chars; // dynamic array
+ // thread-safety: same as `capabilities`
+ char32_t *signature_help_retrigger_chars; // dynamic array
SDL_mutex *workspace_folders_mutex;
LSPDocumentID *workspace_folders; // dynamic array of root directories of LSP workspace folders
SDL_mutex *error_mutex;