summaryrefslogtreecommitdiff
path: root/lsp-write.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2022-12-29 18:44:37 -0500
committerpommicket <pommicket@gmail.com>2022-12-29 18:44:37 -0500
commitd77782564bf0a090a4e7fa4f4c4bb685383275dc (patch)
treea4bc3c0bf142c663ea7f293b4381927adc896f1c /lsp-write.c
parent5f7af06a9085835a3d1ad3a51374c245859d7d97 (diff)
textDocument/definition for ctrl+click
Diffstat (limited to 'lsp-write.c')
-rw-r--r--lsp-write.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/lsp-write.c b/lsp-write.c
index 7db0f66..7d8a0f1 100644
--- a/lsp-write.c
+++ b/lsp-write.c
@@ -1,3 +1,5 @@
+#define write_bool lsp_write_bool // prevent naming conflict
+
static const char *lsp_language_id(Language lang) {
switch (lang) {
case LANG_CONFIG:
@@ -267,6 +269,8 @@ static const char *lsp_request_method(LSPRequest *request) {
return "textDocument/signatureHelp";
case LSP_REQUEST_HOVER:
return "textDocument/hover";
+ case LSP_REQUEST_DEFINITION:
+ return "textDocument/definition";
case LSP_REQUEST_WORKSPACE_FOLDERS:
return "workspace/workspaceFolders";
case LSP_REQUEST_DID_CHANGE_WORKSPACE_FOLDERS:
@@ -296,6 +300,7 @@ static bool request_type_is_notification(LSPRequestType type) {
case LSP_REQUEST_COMPLETION:
case LSP_REQUEST_SIGNATURE_HELP:
case LSP_REQUEST_HOVER:
+ case LSP_REQUEST_DEFINITION:
case LSP_REQUEST_WORKSPACE_FOLDERS:
return false;
}
@@ -512,6 +517,12 @@ static void write_request(LSP *lsp, LSPRequest *request) {
write_document_position(o, hover->position);
write_obj_end(o);
} break;
+ case LSP_REQUEST_DEFINITION: {
+ const LSPRequestDefinition *def = &request->data.definition;
+ write_key_obj_start(o, "params");
+ write_document_position(o, def->position);
+ write_obj_end(o);
+ } break;
case LSP_REQUEST_DID_CHANGE_WORKSPACE_FOLDERS: {
const LSPRequestDidChangeWorkspaceFolders *w = &request->data.change_workspace_folders;
write_key_obj_start(o, "params");
@@ -605,3 +616,5 @@ static void write_message(LSP *lsp, LSPMessage *message) {
// (as i'm writing this, this won't do anything but it might in the future)
lsp_message_free(message);
}
+
+#undef write_bool