Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions lua/gitlab/actions/common.lua
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,13 @@ M.jump_to_file = function(tree)
u.notify("This comment was not left on a particular location", vim.log.levels.WARN)
return
end
if vim.fn.filereadable(root_node.file_name) == 0 then
u.notify(
string.format("The file %s for which the comment was made doesn't exist in HEAD.", root_node.file_name),
vim.log.levels.WARN
)
return
end
vim.cmd.tabnew()
local line_number = get_new_line(root_node) or get_old_line(root_node)
if line_number == nil then
Expand Down
8 changes: 7 additions & 1 deletion lua/gitlab/reviewer/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ M.jump = function(file_name, line_number, new_buffer)
return
end
vim.api.nvim_set_current_tabpage(M.tabnr)
vim.cmd("DiffviewFocusFiles")
local view = diffview_lib.get_current_view()
if view == nil then
u.notify("Could not find Diffview view", vim.log.levels.ERROR)
Expand All @@ -120,6 +119,13 @@ M.jump = function(file_name, line_number, new_buffer)
local file = List.new(files):find(function(file)
return file.path == file_name
end)
if file == nil then
u.notify(
string.format("The file %s for which the comment was made doesn't exist in HEAD.", file_name),
vim.log.levels.WARN
)
return
end
async.await(view:set_file(file))

local layout = view.cur_layout
Expand Down
Loading