aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--init.lua13
-rw-r--r--lspc.lua2
2 files changed, 10 insertions, 5 deletions
diff --git a/init.lua b/init.lua
index bd54f22..c85df1e 100644
--- a/init.lua
+++ b/init.lua
@@ -362,14 +362,13 @@ local function lspc_select(choices)
local cmd = 'printf "' .. menu_input .. '" | ' .. lspc.menu_cmd
lspc.log('collect choice using: ' .. cmd)
- if lspc.menu_cmd == 'vis-menu' then
+ if lspc.menu_cmd:sub(0, 8) == 'vis-menu' then
status, output = vis:pipe(vis.win.file, {start = 0, finish = 0}, cmd)
else
local menu = io.popen(cmd)
output = menu:read('*a')
local _, _, _status = menu:close()
status = _status
-
end
local choice = nil
@@ -1078,7 +1077,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 +1088,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 +1111,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,
}
diff --git a/lspc.lua b/lspc.lua
index 299c2a2..7894507 100644
--- a/lspc.lua
+++ b/lspc.lua
@@ -13,7 +13,7 @@ local lspc = {
autostart = true,
-- program used to let the user make choices
-- The available choices are pass to <menu_cmd> on stdin separated by '\n'
- menu_cmd = 'vis-menu',
+ menu_cmd = 'vis-menu -l 10',
-- program used to ask the user for confirmation
confirm_cmd = 'vis-menu',