diff options
author | pommicket <pommicket@gmail.com> | 2023-01-07 22:32:59 -0500 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2023-01-07 22:32:59 -0500 |
commit | 01d5fcc72f6ea29d0f90b845b7565137e7daac14 (patch) | |
tree | 39346ae60c418345612ad6c6634943cc630d713d /lsp.c | |
parent | cb55279a20865fcfde23a160233155d23a09a03b (diff) |
fix tags go-to-definition menu, silence errors for LSP not found
Diffstat (limited to 'lsp.c')
-rw-r--r-- | lsp.c | 26 |
1 files changed, 21 insertions, 5 deletions
@@ -294,12 +294,27 @@ static bool lsp_receive(LSP *lsp, size_t max_size) { { // check process status - char text[64] = {0}; - int status = process_check_status(&lsp->process, text, sizeof text); + ProcessExitInfo info = {0}; + int status = process_check_status(&lsp->process, &info); if (status != 0) { - lsp_set_error(lsp, "Can't access LSP server: %s\n" - "Run ted in a terminal or set lsp-log = on for more details." - , text); + bool not_found = + #if _WIN32 + #error "@TODO: what status does cmd return if the program is not found?" + #else + info.exit_code == 127; + #endif + + if (not_found) { + // don't give an error if the server is not found. + // still log it though. + if (lsp->log) + fprintf(lsp->log, "LSP server exited: %s. Probably the server is not installed.", + info.message); + } else { + lsp_set_error(lsp, "Can't access LSP server: %s\n" + "Run ted in a terminal or set lsp-log = on for more details." + , info.message); + } return false; } @@ -392,6 +407,7 @@ static bool lsp_send(LSP *lsp) { quit = true; } } + lsp->died = true; free(messages); return quit; |