aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp/buf.lua
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/lua/vim/lsp/buf.lua')
-rw-r--r--runtime/lua/vim/lsp/buf.lua15
1 files changed, 15 insertions, 0 deletions
diff --git a/runtime/lua/vim/lsp/buf.lua b/runtime/lua/vim/lsp/buf.lua
index 79d43fda4a..51295e5570 100644
--- a/runtime/lua/vim/lsp/buf.lua
+++ b/runtime/lua/vim/lsp/buf.lua
@@ -1,3 +1,4 @@
+local vim = vim
local validate = vim.validate
local api = vim.api
local vfn = vim.fn
@@ -330,5 +331,19 @@ function M.rename(new_name)
end)
end
+function M.references(context)
+ validate { context = { context, 't', true } }
+ local params = util.make_position_params()
+ params.context = context or {
+ includeDeclaration = true;
+ }
+ params[vim.type_idx] = vim.types.dictionary
+ request('textDocument/references', params, function(_, _, result)
+ if not result then return end
+ util.set_qflist(result)
+ vim.api.nvim_command("copen")
+ end)
+end
+
return M
-- vim:sw=2 ts=2 et