feat(lsp,diagnostic): open folds in jump-related functions (#16784)

(cherry picked from commit ddf545c152)

Co-authored-by: Dmytro Meleshko <dmytro.meleshko@gmail.com>
This commit is contained in:
github-actions[bot]
2021-12-25 10:43:28 -05:00
committed by GitHub
parent 7b60ec79ea
commit ee9e3420fd
2 changed files with 9 additions and 4 deletions

View File

@ -504,10 +504,13 @@ local function diagnostic_move_pos(opts, pos)
return return
end end
-- Save position in the window's jumplist vim.api.nvim_win_call(win_id, function()
vim.api.nvim_win_call(win_id, function() vim.cmd("normal! m'") end) -- Save position in the window's jumplist
vim.cmd("normal! m'")
vim.api.nvim_win_set_cursor(win_id, {pos[1] + 1, pos[2]}) vim.api.nvim_win_set_cursor(win_id, {pos[1] + 1, pos[2]})
-- Open folds under the cursor
vim.cmd("normal! zv")
end)
if float then if float then
local float_opts = type(float) == "table" and float or {} local float_opts = type(float) == "table" and float or {}

View File

@ -998,6 +998,8 @@ function M.jump_to_location(location)
local row = range.start.line local row = range.start.line
local col = get_line_byte_from_position(0, range.start) local col = get_line_byte_from_position(0, range.start)
api.nvim_win_set_cursor(0, {row + 1, col}) api.nvim_win_set_cursor(0, {row + 1, col})
-- Open folds under the cursor
vim.cmd("normal! zv")
return true return true
end end