Skip to content

Commit 571173c

Browse files
fix: Comments on unchanged, expanded lines (#146)
This MR fixes an issue with refreshes of the diagnostics and signs when users leave comments on unchanged lines.
1 parent cf73d62 commit 571173c

File tree

6 files changed

+244
-155
lines changed

6 files changed

+244
-155
lines changed

lua/gitlab/actions/discussions/annotations.lua

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,19 @@
7171
---@field resolved_discussions number
7272
---@field resolvable_notes number
7373
---@field resolved_notes number
74+
---
75+
---@class SignTable
76+
---@field name string
77+
---@field group string
78+
---@field priority number
79+
---@field id number
80+
---@field lnum number
81+
---@field buffer number?
82+
---
83+
---@class DiagnosticTable
84+
---@field message string
85+
---@field col number
86+
---@field severity number
87+
---@field user_data table
88+
---@field source string
89+
---@field code string?

lua/gitlab/actions/discussions/init.lua

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -336,17 +336,17 @@ end
336336

337337
-- This function (settings.discussion_tree.jump_to_reviewer) will jump the cursor to the reviewer's location associated with the note. The implementation depends on the reviewer
338338
M.jump_to_reviewer = function(tree)
339-
local file_name, new_line, old_line, error = M.get_note_location(tree)
339+
local file_name, new_line, old_line, is_undefined_type, error = M.get_note_location(tree)
340340
if error ~= nil then
341341
u.notify(error, vim.log.levels.ERROR)
342342
return
343343
end
344-
reviewer.jump(file_name, new_line, old_line)
344+
reviewer.jump(file_name, new_line, old_line, { is_undefined_type = is_undefined_type })
345345
end
346346

347347
-- This function (settings.discussion_tree.jump_to_file) will jump to the file changed in a new tab
348348
M.jump_to_file = function(tree)
349-
local file_name, new_line, old_line, error = M.get_note_location(tree)
349+
local file_name, new_line, old_line, _, error = M.get_note_location(tree)
350350
if error ~= nil then
351351
u.notify(error, vim.log.levels.ERROR)
352352
return
@@ -666,16 +666,21 @@ end
666666

667667
---Get note location
668668
---@param tree NuiTree
669+
---@return string, string, string, boolean, string?
669670
M.get_note_location = function(tree)
670671
local node = tree:get_node()
671672
if node == nil then
672-
return nil, nil, nil, "Could not get node"
673+
return "", "", "", false, "Could not get node"
673674
end
674675
local discussion_node = M.get_root_node(tree, node)
675676
if discussion_node == nil then
676-
return nil, nil, nil, "Could not get discussion node"
677+
return "", "", "", false, "Could not get discussion node"
677678
end
678-
return discussion_node.file_name, discussion_node.new_line, discussion_node.old_line
679+
return discussion_node.file_name,
680+
discussion_node.new_line,
681+
discussion_node.old_line,
682+
discussion_node.undefined_type or false,
683+
nil
679684
end
680685

681686
return M

0 commit comments

Comments
 (0)