Skip to content

Commit

Permalink
fix(quickfix cmd): construct items from visited buffers
Browse files Browse the repository at this point in the history
  • Loading branch information
MariaSolOs committed Aug 31, 2023
1 parent d084646 commit caa1c81
Showing 1 changed file with 14 additions and 20 deletions.
34 changes: 14 additions & 20 deletions lua/git-conflict.lua
Original file line number Diff line number Diff line change
Expand Up @@ -690,29 +690,23 @@ end
---@param callback fun(files: table<string, integer[]>)
function M.conflicts_to_qf_items(callback)
local items = {}
---@diagnostic disable-next-line: missing-parameter
get_conflicted_files(fn.expand('%:p:h'), function(files)
for filename, _ in pairs(files) do
local item = {
filename = filename,
pattern = conflict_start,
text = 'git conflict',
type = 'E',
valid = 1,
}
local visited_buf = nil

local buf = visited_buffers[filename]
if buf and next(buf) then visited_buf = buf end
for filename, visited_buf in pairs(visited_buffers) do
local item = {
filename = filename,
pattern = conflict_start,
text = 'git conflict',
type = 'E',
valid = 1,
}

if visited_buf then
quickfix_items_from_positions(item, items, visited_buf)
else
table.insert(items, item)
end
if visited_buf and next(visited_buf) then
quickfix_items_from_positions(item, items, visited_buf)
else
table.insert(items, item)
end

callback(items)
end)
end
end

---@param bufnr integer?
Expand Down

0 comments on commit caa1c81

Please sign in to comment.