diff options
author | Josh Rahm <joshuarahm@gmail.com> | 2022-08-07 16:01:34 -0600 |
---|---|---|
committer | Josh Rahm <joshuarahm@gmail.com> | 2022-08-07 16:01:34 -0600 |
commit | a5f27a311fb28797a72b8aa16ec7122c5a1b15e4 (patch) | |
tree | 3732f7339e29431f31310aef6ffc802cf4f6255d /runtime/lua/vim/lsp/handlers.lua | |
parent | 6c909fedc924d9f4257aa204b0168c6177cc5d28 (diff) | |
parent | 629169462a82f0fbb7a8911a4554894537d6776c (diff) | |
download | rneovim-a5f27a311fb28797a72b8aa16ec7122c5a1b15e4.tar.gz rneovim-a5f27a311fb28797a72b8aa16ec7122c5a1b15e4.tar.bz2 rneovim-a5f27a311fb28797a72b8aa16ec7122c5a1b15e4.zip |
Merge branch 'master' of https://github.com/neovim/neovim into rahm
Diffstat (limited to 'runtime/lua/vim/lsp/handlers.lua')
-rw-r--r-- | runtime/lua/vim/lsp/handlers.lua | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/runtime/lua/vim/lsp/handlers.lua b/runtime/lua/vim/lsp/handlers.lua index 1e6ac8dddf..624436bc9b 100644 --- a/runtime/lua/vim/lsp/handlers.lua +++ b/runtime/lua/vim/lsp/handlers.lua @@ -348,19 +348,19 @@ local function location_handler(_, result, ctx, config) -- https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_definition if vim.tbl_islist(result) then - util.jump_to_location(result[1], client.offset_encoding, config.reuse_win) - - if #result > 1 then - local title = 'LSP locations' - local items = util.locations_to_items(result, client.offset_encoding) + local title = 'LSP locations' + local items = util.locations_to_items(result, client.offset_encoding) - if config.on_list then - assert(type(config.on_list) == 'function', 'on_list is not a function') - config.on_list({ title = title, items = items }) - else - vim.fn.setqflist({}, ' ', { title = title, items = items }) - api.nvim_command('botright copen') + if config.on_list then + assert(type(config.on_list) == 'function', 'on_list is not a function') + config.on_list({ title = title, items = items }) + else + if #result == 1 then + util.jump_to_location(result[1], client.offset_encoding, config.reuse_win) + return end + vim.fn.setqflist({}, ' ', { title = title, items = items }) + api.nvim_command('botright copen') end else util.jump_to_location(result, client.offset_encoding, config.reuse_win) |