From 455b94a8bd379888f7e6bd932cc256cb3918e529 Mon Sep 17 00:00:00 2001 From: bhagwan Date: Tue, 2 Apr 2024 11:38:17 -0700 Subject: [PATCH] feat(lsp_finder): custom `lsp_params` (closes #1108) --- lua/fzf-lua/providers/lsp.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lua/fzf-lua/providers/lsp.lua b/lua/fzf-lua/providers/lsp.lua index 0ed6d40c..7f15132a 100644 --- a/lua/fzf-lua/providers/lsp.lua +++ b/lua/fzf-lua/providers/lsp.lua @@ -536,7 +536,7 @@ end -- see $VIMRUNTIME/lua/vim/buf.lua:pick_call_hierarchy_item() local function gen_lsp_contents_call_hierarchy(opts) - local lsp_params = vim.lsp.util.make_position_params(core.CTX().winid) + local lsp_params = opts.lsp_params or vim.lsp.util.make_position_params(core.CTX().winid) local method = "textDocument/prepareCallHierarchy" local res, err = vim.lsp.buf_request_sync(0, method, lsp_params, 2000) if err then @@ -620,6 +620,7 @@ M.finder = function(opts) if not opts then return end if opts.force_uri == nil then opts.force_uri = true end local contents = {} + local lsp_params = opts.lsp_params for _, p in ipairs(opts.providers) do local method = p[1] if not opts._providers[method] then @@ -629,7 +630,7 @@ M.finder = function(opts) opts.no_autoclose = true opts.lsp_handler = handlers[method] opts.lsp_handler.capability = handler_capabilty(opts.lsp_handler) - opts.lsp_params = nil -- empty out previous calls params if existed + opts.lsp_params = lsp_params -- reset previous calls params if existed -- returns nil for no client attached, false for unsupported capability -- we only abort if no client is attached