diff options
author | pommicket <pommicket@gmail.com> | 2022-12-29 23:13:23 -0500 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2022-12-29 23:13:23 -0500 |
commit | a0f8332da674d452f7ae4f84f01d4682d464c9b2 (patch) | |
tree | d003832a43f92b8b466815dc3f1354e5b69da11d /lsp.h | |
parent | adbfd5f248d390ae73eb9da636a457ce770c9ac0 (diff) |
show the wait cursor when waiting for go to definition
Diffstat (limited to 'lsp.h')
-rw-r--r-- | lsp.h | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -1,5 +1,6 @@ typedef u32 LSPDocumentID; typedef u32 LSPID; +typedef u32 LSPRequestID; typedef struct { u32 line; @@ -350,8 +351,8 @@ typedef struct LSP { Process process; // Which ID number the next request will get - // thread-safety: only accessed in communication thread - u32 request_id; + // thread-safety: atomic, all that matters is `LSPRequestID id = ++lsp->request_id;` works + _Atomic LSPRequestID request_id; SDL_mutex *document_mutex; // for our purposes, folders are "documents" @@ -402,9 +403,9 @@ void lsp_message_free(LSPMessage *message); u32 lsp_document_id(LSP *lsp, const char *path); // returned pointer lives exactly as long as lsp. const char *lsp_document_path(LSP *lsp, LSPDocumentID id); -// returns false if the request is not supported by the LSP +// returns the ID of the sent request, or 0 if the request is not supported by the LSP // don't free the contents of this request (even on failure)! let me handle it! -bool lsp_send_request(LSP *lsp, LSPRequest *request); +LSPRequestID lsp_send_request(LSP *lsp, LSPRequest *request); // don't free the contents of this response! let me handle it! void lsp_send_response(LSP *lsp, LSPResponse *response); const char *lsp_response_string(const LSPResponse *response, LSPString string); |