Skip to content

Commit 84b9ba0

Browse files
authored
fix(lsp): use correct error field in client request result (#3554)
Also improve some annotations.
1 parent 41e7239 commit 84b9ba0

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

lua/telescope/builtin/__lsp.lua

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
---@alias TextDocumentFunction fun(client: vim.lsp.Client): lsp.TextDocumentPositionParams
2+
13
local channel = require("plenary.async.control").channel
24
local actions = require "telescope.actions"
35
local sorters = require "telescope.sorters"
@@ -68,12 +70,12 @@ local function pick_call_hierarchy_item(call_hierarchy_items)
6870
return call_hierarchy_items[choice]
6971
end
7072

71-
---@param win number? Window handler
72-
---@param extra table? Extra fields in params
73-
---@return table|(fun(client: vim.lsp.Client): table) parmas to send to the server
73+
---@param win number|nil: Window handler
74+
---@param extra lsp.TextDocumentPositionParams|nil: Extra fields in params
75+
---@return lsp.TextDocumentPositionParams|TextDocumentFunction: Params to send to the server
7476
local function client_position_params(win, extra)
7577
win = win or vim.api.nvim_get_current_win()
76-
if vim.fn.has "nvim-0.11" == 0 then
78+
if 1 ~= vim.fn.has "nvim-0.11" then
7779
local params = vim.lsp.util.make_position_params(win)
7880
if extra then
7981
params = vim.tbl_extend("force", params, extra)
@@ -204,7 +206,7 @@ local function list_or_jump(action, title, funname, params, opts)
204206
local errors = {}
205207

206208
for client_id, result_or_error in pairs(results_per_client) do
207-
local error, result = result_or_error.error, result_or_error.result
209+
local error, result = result_or_error.err, result_or_error.result
208210
if error then
209211
errors[client_id] = error
210212
else

0 commit comments

Comments
 (0)