diff options
author | pommicket <pommicket@gmail.com> | 2022-12-31 12:12:07 -0500 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2022-12-31 12:12:07 -0500 |
commit | b45acfb66cd4c4474d3fd951d2a1b0fe3b63ae0b (patch) | |
tree | 61209fe68bd406e26e4f356043c7836668b8cd5b /ide-definitions.c | |
parent | 02faedf9bf7e826bc78161f8cf07ffca5d2dbe57 (diff) |
better LSP request cancelling
Diffstat (limited to 'ide-definitions.c')
-rw-r--r-- | ide-definitions.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/ide-definitions.c b/ide-definitions.c index 46dc1f4..6ea0547 100644 --- a/ide-definitions.c +++ b/ide-definitions.c @@ -1,6 +1,6 @@ void definition_cancel_lookup(Ted *ted) { Definitions *defs = &ted->definitions; - lsp_cancel_request(ted_get_lsp_by_id(ted, defs->last_request_lsp), defs->last_request_id); + ted_cancel_lsp_request(ted, defs->last_request_lsp, defs->last_request_id); defs->last_request_id = 0; } @@ -52,11 +52,12 @@ static SymbolKind symbol_kind_to_ted(LSPSymbolKind kind) { void definition_goto(Ted *ted, LSP *lsp, const char *name, LSPDocumentPosition position) { Definitions *defs = &ted->definitions; if (lsp) { + // cancel old request + ted_cancel_lsp_request(ted, defs->last_request_lsp, defs->last_request_id); // send that request LSPRequest request = {.type = LSP_REQUEST_DEFINITION}; request.data.definition.position = position; LSPRequestID id = lsp_send_request(lsp, &request); - lsp_cancel_request(lsp, defs->last_request_id); // cancel old request defs->last_request_id = id; defs->last_request_lsp = lsp->id; defs->last_request_time = ted->frame_time; @@ -220,7 +221,7 @@ void definitions_selector_open(Ted *ted) { void definitions_selector_close(Ted *ted) { Definitions *defs = &ted->definitions; definitions_clear_entries(defs); - lsp_cancel_request(ted_get_lsp_by_id(ted, defs->last_request_lsp), defs->last_request_id); + ted_cancel_lsp_request(ted, defs->last_request_lsp, defs->last_request_id); defs->last_request_id = 0; free(defs->last_request_query); defs->last_request_query = NULL; |