summaryrefslogtreecommitdiff
path: root/lsp-parse.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2023-01-05 14:08:54 -0500
committerpommicket <pommicket@gmail.com>2023-01-05 14:08:54 -0500
commitda244a2bfb1e1139e772e272166fc0ecd4898ad4 (patch)
tree7f610d86553fc3cbbef520fe51a800cc7190276c /lsp-parse.c
parent3e0548caa2cf7d6b32cc029dbc9044ef877f6cee (diff)
lsp-configuration option
Diffstat (limited to 'lsp-parse.c')
-rw-r--r--lsp-parse.c46
1 files changed, 24 insertions, 22 deletions
diff --git a/lsp-parse.c b/lsp-parse.c
index 7bbcbd1..8c914fa 100644
--- a/lsp-parse.c
+++ b/lsp-parse.c
@@ -929,30 +929,32 @@ void process_message(LSP *lsp, JSON *json) {
case LSP_REQUEST_RENAME:
add_to_messages = parse_rename(lsp, json, &response);
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);
- }
-
- LSPRequest initialized = {
- .type = LSP_REQUEST_INITIALIZED,
- .data = {{0}},
- };
- write_request(lsp, &initialized);
- // we can now send requests which have nothing to do with initialization
- lsp->initialized = true;
- {
- // configure jdtls so it actually supports signature help
- // NOTE: this won't send if the LSP isn't jdtls (because of lsp_supports_request)
- LSPRequest jdtls_configuration = {
- .type = LSP_REQUEST_JDTLS_CONFIGURATION
+ case LSP_REQUEST_INITIALIZE:
+ if (!lsp->initialized) {
+ // 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);
+ }
+
+ LSPRequest initialized = {
+ .type = LSP_REQUEST_INITIALIZED,
+ .data = {{0}},
};
- lsp_send_request(lsp, &jdtls_configuration);
+ write_request(lsp, &initialized);
+ // we can now send requests which have nothing to do with initialization
+ lsp->initialized = true;
+ if (lsp->configuration_to_send) {
+ LSPRequest configuration = {
+ .type = LSP_REQUEST_CONFIGURATION
+ };
+ configuration.data.configuration.settings = lsp->configuration_to_send;
+ lsp->configuration_to_send = NULL;
+ lsp_send_request(lsp, &configuration);
+ }
}
- } break;
+ break;
default:
// it's some response we don't care about
break;