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
5 changes: 1 addition & 4 deletions lua/gitlab/actions/discussions/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ M.initialize_discussions = function()
end)
reviewer.set_callback_for_buf_read(function(args)
vim.api.nvim_set_option_value("modifiable", false, { buf = args.buf })
reviewer.update_winid_for_buffer(args.buf)
reviewer.set_keymaps(args.buf)
reviewer.set_reviewer_autocommands(args.buf)
end)
Expand Down Expand Up @@ -176,10 +177,6 @@ M.open = function(callback, view_type)
if type(callback) == "function" then
callback()
end

vim.schedule(function()
M.refresh_diagnostics()
end)
Comment thread
jakubbortlik marked this conversation as resolved.
end

-- Clears the discussion state and unmounts the split
Expand Down
2 changes: 1 addition & 1 deletion lua/gitlab/indicators/diagnostics.lua
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ end
---Filter and place the diagnostics for the given buffer.
---@param bufnr number The number of the buffer for placing diagnostics.
M.place_diagnostics = function(bufnr)
if not vim.api.nvim_buf_is_valid(bufnr) then
if not bufnr or not vim.api.nvim_buf_is_valid(bufnr) then
return
end
if not state.settings.discussion_signs.enabled then
Expand Down
8 changes: 6 additions & 2 deletions lua/gitlab/reviewer/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ M.open = function()
end
end

M.is_open = true
vim.api.nvim_command(string.format("%s %s..%s", diffview_open_command, diff_refs.base_sha, diff_refs.head_sha))

M.is_open = true
M.diffview = require("diffview.lib").get_current_view()
if M.diffview == nil then
u.notify("Could not find Diffview view", vim.log.levels.ERROR)
Expand Down Expand Up @@ -304,7 +304,11 @@ M.set_callback_for_buf_read = function(callback)
pattern = { "DiffviewDiffBufRead" },
group = group,
callback = function(...)
if vim.api.nvim_get_current_tabpage() == M.tabid then
-- Only run the callback when we're in the MR's tabpage or when the tabpage has
-- not yet been set (tabid = nil) in a freshly started review (is_open = true).
-- TODO: This is a hacky workaround for cases when an added file is diffeed
-- against diffview://null and this autocommand fires before tabid is set.
if vim.api.nvim_get_current_tabpage() == M.tabid or (M.is_open and M.tabid == nil) then
callback(...)
end
end,
Expand Down
Loading