diff options
author | pommicket <pommicket@gmail.com> | 2023-09-07 14:06:16 -0400 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2023-09-07 14:06:16 -0400 |
commit | bb4b7774aabc2686f936935b02899b1aa0bf1f2b (patch) | |
tree | d218d61e8163bf2e7cbdc352ab86744e8f250be8 /main.c | |
parent | 7b8b4d4495164250c71582347dd0338d387c4e98 (diff) |
use LSPString in requests too for consistency
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 35 |
1 files changed, 17 insertions, 18 deletions
@@ -874,37 +874,36 @@ int main(int argc, char **argv) { while (lsp_next_message(lsp, &message)) { switch (message.type) { case LSP_REQUEST: { - LSPRequest *r = &message.u.request; + LSPRequest *r = &message.request; switch (r->type) { case LSP_REQUEST_SHOW_MESSAGE: { LSPRequestMessage *m = &r->data.message; MessageType type = ted_message_type_from_lsp(m->type); - ted_set_message(ted, type, "%s", m->message); + ted_set_message(ted, type, "%s", lsp_request_string(r, m->message)); } break; case LSP_REQUEST_LOG_MESSAGE: { LSPRequestMessage *m = &r->data.message; - ted_log(ted, "%s\n", m->message); + ted_log(ted, "%s\n", lsp_request_string(r, m->message)); } break; default: break; } } break; case LSP_RESPONSE: { - LSPResponse *r = &message.u.response; - if (r->error) { - // not displaying this right now - // idk it might be spammy - //ted_error(ted, "%s", r->error); + LSPResponse *r = &message.response; + if (!lsp_string_is_empty(r->error)) { + ted_error(ted, "LSP error: %s", lsp_response_string(r, r->error)); + } else { + // it's important that we send error responses here too. + // we don't want to be waiting around for a response that's never coming. + autocomplete_process_lsp_response(ted, r); + signature_help_process_lsp_response(ted, r); + hover_process_lsp_response(ted, r); + definitions_process_lsp_response(ted, lsp, r); + highlights_process_lsp_response(ted, r); + usages_process_lsp_response(ted, r); + document_link_process_lsp_response(ted, r); + rename_symbol_process_lsp_response(ted, r); } - // it's important that we send error responses here too. - // we don't want to be waiting around for a response that's never coming. - autocomplete_process_lsp_response(ted, r); - signature_help_process_lsp_response(ted, r); - hover_process_lsp_response(ted, r); - definitions_process_lsp_response(ted, lsp, r); - highlights_process_lsp_response(ted, r); - usages_process_lsp_response(ted, r); - document_link_process_lsp_response(ted, r); - rename_symbol_process_lsp_response(ted, r); } break; } lsp_message_free(&message); |