From 27c9af7de5f47c33217be02107e31061366f481f Mon Sep 17 00:00:00 2001 From: pommicket Date: Thu, 8 Dec 2022 11:20:54 -0500 Subject: fix response receiving --- main.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index 23b6119..82a0ef1 100644 --- a/main.c +++ b/main.c @@ -292,8 +292,9 @@ int main(int argc, char **argv) { printf("lsp_create: %s\n",lsp.error); exit(1); } -// LSPRequest test_req = {LSP_COMPLETION}; -// lsp_send_request(&lsp, &test_req); + usleep(500000);//if we don't do this we get "waiting for cargo metadata or cargo check" + LSPRequest test_req = {.type = LSP_COMPLETION}; + lsp_send_request(&lsp, &test_req); while (1) { JSON response = {0}; if (lsp_next_response(&lsp, &response)) { @@ -301,6 +302,10 @@ int main(int argc, char **argv) { printf("\n"); break; } + char error[256]; + if (lsp_get_error(&lsp, error, sizeof error, true)) { + printf("lsp error: %s\n", error); + } usleep(10000); } lsp_free(&lsp); -- cgit v1.2.3