summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2022-12-08 11:20:54 -0500
committerpommicket <pommicket@gmail.com>2022-12-08 11:20:54 -0500
commit27c9af7de5f47c33217be02107e31061366f481f (patch)
treef1a6b88a5d6f1beb0fdbf977ab5766caa33e946c /main.c
parentb913d130a3155a7630b34300b5d9d7fd522d61f1 (diff)
fix response receiving
Diffstat (limited to 'main.c')
-rw-r--r--main.c9
1 files changed, 7 insertions, 2 deletions
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);