Skip to content

Commit 92bb44e

Browse files
authored
fix: Prevent lsp request from beeing endlesly pending (#167)
* Prevent endless lsp request * Annotate notify_reply_callback as nullable
1 parent c915ab5 commit 92bb44e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lua/crates/lsp.lua

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,10 @@ function M.server(opts)
4141
---@param method string
4242
---@param params any
4343
---@param callback fun(method: string?, params: any)
44+
---@param notify_reply_callback? fun(request_id: integer)
4445
---@return boolean
4546
---@return integer
46-
function srv.request(method, params, callback)
47+
function srv.request(method, params, callback, notify_reply_callback)
4748
pcall(on_request, method, params)
4849
local handler = handlers[method]
4950
if handler then
@@ -56,6 +57,9 @@ function M.server(opts)
5657
callback(nil, nil)
5758
end
5859
request_id = request_id + 1
60+
if notify_reply_callback then
61+
notify_reply_callback(request_id)
62+
end
5963
return true, request_id
6064
end
6165

0 commit comments

Comments
 (0)