summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2022-12-20 20:39:43 -0500
committerpommicket <pommicket@gmail.com>2022-12-20 20:39:43 -0500
commit885df8890e537383df71f8f828444d6c5cce0243 (patch)
tree469388524c6738c3c44d9ee45c5d114b6ed0cb44 /main.c
parentd3375f02cfed99ed40c28631e62654af23817729 (diff)
more completion
Diffstat (limited to 'main.c')
-rw-r--r--main.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/main.c b/main.c
index 06b52c2..6176bf5 100644
--- a/main.c
+++ b/main.c
@@ -327,7 +327,7 @@ int main(int argc, char **argv) {
while (lsp_next_message(&lsp, &message)) {
if (message.type == LSP_RESPONSE) {
const LSPResponse *response = &message.u.response;
- switch (response->type) {
+ switch (response->request.type) {
case LSP_REQUEST_COMPLETION: {
const LSPResponseCompletion *completion = &response->data.completion;
arr_foreach_ptr(completion->items, LSPCompletionItem, item) {
@@ -880,6 +880,38 @@ int main(int argc, char **argv) {
menu_update(ted);
}
+ {
+ LSP *lsp = ted_get_active_lsp(ted);
+ if (lsp) {
+ LSPMessage message = {0};
+ while (lsp_next_message(lsp, &message)) {
+ switch (message.type) {
+ case LSP_REQUEST: {
+ LSPRequest *r = &message.u.request;
+ switch (r->type) {
+ case LSP_REQUEST_SHOW_MESSAGE: {
+ LSPRequestMessage *m = &r->data.message;
+ // @TODO: multiple messages
+ ted_seterr(ted, "%s", m->message);
+ } break;
+ case LSP_REQUEST_LOG_MESSAGE: {
+ LSPRequestMessage *m = &r->data.message;
+ // @TODO: actual logging
+ printf("%s\n", m->message);
+ } break;
+ default: break;
+ }
+ } break;
+ case LSP_RESPONSE: {
+ LSPResponse *r = &message.u.response;
+ autocomplete_process_lsp_response(ted, r);
+ } break;
+ }
+ lsp_message_free(&message);
+ }
+ }
+ }
+
ted_update_window_dimensions(ted);
float window_width = ted->window_width, window_height = ted->window_height;