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(quickfix cmd): construct items from visited buffers #68

Merged
merged 1 commit into from
Aug 31, 2023
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
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