Skip to content

Commit

Permalink
fix(lsp_references): not changing files if only 1 result (#2229)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gordin committed Nov 11, 2022
1 parent cc77713 commit 7a4ffef
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lua/telescope/builtin/__lsp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,13 @@ lsp.references = function(opts)
vim.cmd "vnew"
end
-- jump to location
vim.api.nvim_win_set_buf(0, opts.bufnr)
vim.api.nvim_win_set_cursor(0, { locations[1].lnum, locations[1].col - 1 })
local location = locations[1]
local bufnr = opts.bufnr
if location.filename then
bufnr = vim.uri_to_bufnr(vim.uri_from_fname(location.filename))
end
vim.api.nvim_win_set_buf(0, bufnr)
vim.api.nvim_win_set_cursor(0, { location.lnum, location.col - 1 })
return
end

Expand Down

0 comments on commit 7a4ffef

Please sign in to comment.