Skip to content

Commit

Permalink
fix definition jump error
Browse files Browse the repository at this point in the history
  • Loading branch information
CnsMaple committed Dec 6, 2023
1 parent 29d5f05 commit e42012d
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions lua/navigator/definition.lua
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,18 @@ local definition_hdlr = function(err, locations, ctx, _)
local items = locations_to_items(locations)
gui.new_list_view({ items = items, api = 'Definition', title = 'Definition' })
else
local loc = vim.lsp.util.make_position_params()
-- let check if the location is same as current
if
loc.textDocument.uri == locations[1].uri
and loc.position.line == locations[1].range.start.line
and loc.position.character == locations[1].range.start.character
then
vim.lsp.buf.type_definition()
else
vim.lsp.util.jump_to_location(locations[1], oe)
end
vim.lsp.util.jump_to_location(locations[1], oe)
-- local loc = vim.lsp.util.make_position_params()
-- -- let check if the location is same as current
-- if
-- loc.textDocument.uri == locations[1].uri
-- and loc.position.line == locations[1].range.start.line
-- and loc.position.character == locations[1].range.start.character
-- then
-- vim.lsp.buf.type_definition()
-- else
-- vim.lsp.util.jump_to_location(locations[1], oe)
-- end
end
else
vim.lsp.util.jump_to_location(locations, oe)
Expand Down

0 comments on commit e42012d

Please sign in to comment.