summaryrefslogtreecommitdiff
path: root/lsp-write.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2022-12-27 23:15:27 -0500
committerpommicket <pommicket@gmail.com>2022-12-27 23:15:27 -0500
commit47adb1651d35dcc545850916c4a16b747901dba5 (patch)
treef329f973016d15f17b0437202c26f4ca93a0b7be /lsp-write.c
parente112a90ff73f7f407ed2251f905565713c237bc1 (diff)
more signature help
Diffstat (limited to 'lsp-write.c')
-rw-r--r--lsp-write.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/lsp-write.c b/lsp-write.c
index 835cfce..910eb1b 100644
--- a/lsp-write.c
+++ b/lsp-write.c
@@ -1,5 +1,3 @@
-
-
static const char *lsp_language_id(Language lang) {
switch (lang) {
case LANG_CONFIG:
@@ -228,6 +226,13 @@ static void write_workspace_folders(JSONWriter *o, LSPDocumentID *workspace_fold
write_arr_end(o);
}
+static void write_document_position(JSONWriter *o, LSPDocumentPosition pos) {
+ write_key_obj_start(o, "textDocument");
+ write_key_file_uri(o, "uri", pos.document);
+ write_obj_end(o);
+ write_key_position(o, "position", pos.pos);
+}
+
static const char *lsp_request_method(LSPRequest *request) {
switch (request->type) {
case LSP_REQUEST_NONE: break;
@@ -454,10 +459,7 @@ static void write_request(LSP *lsp, LSPRequest *request) {
case LSP_REQUEST_COMPLETION: {
const LSPRequestCompletion *completion = &request->data.completion;
write_key_obj_start(o, "params");
- write_key_obj_start(o, "textDocument");
- write_key_file_uri(o, "uri", completion->position.document);
- write_obj_end(o);
- write_key_position(o, "position", completion->position.pos);
+ write_document_position(o, completion->position);
const LSPCompletionContext *context = &completion->context;
LSPCompletionTriggerKind trigger_kind = context->trigger_kind;
if (trigger_kind != LSP_TRIGGER_NONE) {
@@ -469,6 +471,12 @@ static void write_request(LSP *lsp, LSPRequest *request) {
}
write_obj_end(o);
} break;
+ case LSP_REQUEST_SIGNATURE_HELP: {
+ const LSPRequestSignatureHelp *help = &request->data.signature_help;
+ write_key_obj_start(o, "params");
+ write_document_position(o, help->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");