Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: correcting some problem with review mode #225

Merged
Merged
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
27 changes: 12 additions & 15 deletions lua/gitlab/actions/discussions/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -392,20 +392,17 @@ end
---@param node any
---@return number|nil
local function get_new_line(node)
if node.new_line == nil then
return nil
end

---@type GitlabLineRange|nil
local range = node.range
if range == nil then
if node.new_line == nil then
return nil
end
return node.new_line
end

local start_new_line, _ = common.parse_line_code(range.start.line_code)
if range.start.new_line ~= nil then
return range.start.new_line
end

local _, start_new_line = common.parse_line_code(range.start.line_code)
return start_new_line
end

Expand All @@ -414,17 +411,17 @@ end
---@param node any
---@return number|nil
local function get_old_line(node)
if node.old_line == nil then
return nil
end

---@type GitlabLineRange|nil
local range = node.range
if range == nil then
return node.old_line
end

local _, start_old_line = common.parse_line_code(range.start.line_code)
if range.start.old_line ~= nil then
return range.start.old_line
end

local start_old_line, _ = common.parse_line_code(range.start.line_code)
return start_old_line
end

Expand Down Expand Up @@ -453,15 +450,15 @@ M.jump_to_file = function(tree)
if line_number == nil then
line_number = 1
end
local bufnr = vim.fn.bufnr(root_node.filename)
local bufnr = vim.fn.bufnr(root_node.file_name)
if bufnr ~= -1 then
vim.cmd("buffer " .. bufnr)
vim.api.nvim_win_set_cursor(0, { line_number, 0 })
return
end

-- If buffer is not already open, open it
vim.cmd("edit " .. root_node.filename)
vim.cmd("edit " .. root_node.file_name)
vim.api.nvim_win_set_cursor(0, { line_number, 0 })
end

Expand Down
Loading