summaryrefslogtreecommitdiff
path: root/lsp-parse.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2022-12-27 00:16:35 -0500
committerpommicket <pommicket@gmail.com>2022-12-27 00:16:35 -0500
commit85ee81b8ae972d17f0e3dc78657077924c047ada (patch)
treec786708c0e3b4d0340e712d01eb0160145e5af38 /lsp-parse.c
parent9a5cad47fe6a8b84892f62e110ca887c95df5eff (diff)
added workspaceFolders support
but broke non-workspaceFolders support
Diffstat (limited to 'lsp-parse.c')
-rw-r--r--lsp-parse.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/lsp-parse.c b/lsp-parse.c
index 6d436d9..8797edf 100644
--- a/lsp-parse.c
+++ b/lsp-parse.c
@@ -79,9 +79,12 @@ static bool parse_range(LSP *lsp, const JSON *json, JSONValue range_value, LSPRa
static void parse_capabilities(LSP *lsp, const JSON *json, JSONObject capabilities) {
+ LSPCapabilities *cap = &lsp->capabilities;
+
+ // check CompletionOptions
JSONValue completion_value = json_object_get(json, capabilities, "completionProvider");
if (completion_value.type == JSON_OBJECT) {
- lsp->provides_completion = true;
+ cap->completion_support = true;
JSONObject completion = completion_value.val.object;
JSONArray trigger_chars = json_object_get_array(json, completion, "triggerCharacters");
@@ -104,6 +107,14 @@ static void parse_capabilities(LSP *lsp, const JSON *json, JSONObject capabiliti
}
}
}
+
+
+ JSONObject workspace = json_object_get_object(json, capabilities, "workspace");
+ // check WorkspaceFoldersServerCapabilities
+ JSONObject workspace_folders = json_object_get_object(json, workspace, "workspaceFolders");
+ if (json_object_get_bool(json, workspace_folders, "supported", false)) {
+ cap->workspace_folders_support = true;
+ }
}
static bool parse_completion(LSP *lsp, const JSON *json, LSPResponse *response) {
@@ -383,15 +394,12 @@ static void process_message(LSP *lsp, JSON *json) {
break;
case LSP_REQUEST_INITIALIZE: {
// it's the response to our initialize request!
-
if (result.type == JSON_OBJECT) {
// read server capabilities
JSONObject capabilities = json_object_get_object(json, result.val.object, "capabilities");
parse_capabilities(lsp, json, capabilities);
}
- // let's send back an "initialized" request (notification) because apparently
- // that's something we need to do.
LSPRequest initialized = {
.type = LSP_REQUEST_INITIALIZED,
.data = {0},