diff options
author | Ashkan Kiani <ashkan.k.kiani@gmail.com> | 2019-11-24 03:01:18 -0800 |
---|---|---|
committer | Ashkan Kiani <ashkan.k.kiani@gmail.com> | 2019-11-24 03:01:18 -0800 |
commit | b35f6aa9dd686d082405132e3455cd0aff334361 (patch) | |
tree | 1efdf6aa7490f8caf757d4c9932111fd199b004e /runtime/lua/vim/lsp/buf.lua | |
parent | b78fdd7ce55ef4f02bff9358ed3a3b7b68618a37 (diff) | |
download | rneovim-b35f6aa9dd686d082405132e3455cd0aff334361.tar.gz rneovim-b35f6aa9dd686d082405132e3455cd0aff334361.tar.bz2 rneovim-b35f6aa9dd686d082405132e3455cd0aff334361.zip |
Add support for textDocument/references.
Add set_qflist and set_loclist.
- Also add locations_to_items, which calculates byte offsets for
character positions in files and avoids unnecessary operations.
Diffstat (limited to 'runtime/lua/vim/lsp/buf.lua')
-rw-r--r-- | runtime/lua/vim/lsp/buf.lua | 15 |
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 |