From 5140a3ae419152735018c2b51887251cccf7a490 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Mon, 9 Jan 2023 01:16:38 +0100 Subject: add context parameter to textDocument/references call Fixes !41. --- init.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index bd54f22..2f6351c 100644 --- a/init.lua +++ b/init.lua @@ -1078,7 +1078,7 @@ end -- generic stub implementation for all textDocument methods taking -- a textDocumentPositionParams parameter -local function lspc_method_doc_pos(ls, method, win, argv) +local function lspc_method_doc_pos(ls, method, win, argv, additional_params) -- check if the language server has a provider for this method if not ls.capabilities[method .. 'Provider'] then return 'language server ' .. ls.name .. ' does not provide ' .. method @@ -1089,6 +1089,11 @@ local function lspc_method_doc_pos(ls, method, win, argv) end local params = vis_doc_pos_to_lsp(vis_get_doc_pos(win)) + if additional_params then + for k, v in pairs(additional_params) do + params[k] = v + end + end ls_call_text_document_method(ls, method, params, win, argv) end @@ -1107,7 +1112,8 @@ local lspc_goto_location_methods = { return lspc_method_doc_pos(ls, 'implementation', win, open_cmd) end, references = function(ls, win, open_cmd) - return lspc_method_doc_pos(ls, 'references', win, open_cmd) + return lspc_method_doc_pos(ls, 'references', win, open_cmd, + {context = {includeDeclaration = false}}) end, } -- cgit v1.2.3