diff options
author | pommicket <pommicket@gmail.com> | 2022-12-08 11:20:54 -0500 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2022-12-08 11:20:54 -0500 |
commit | 27c9af7de5f47c33217be02107e31061366f481f (patch) | |
tree | f1a6b88a5d6f1beb0fdbf977ab5766caa33e946c /main.c | |
parent | b913d130a3155a7630b34300b5d9d7fd522d61f1 (diff) |
fix response receiving
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -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); |