Skip to content

integrate quickfix with accept/reject for cross-file hunk review #12

@cachebag

Description

@cachebag

problem

<leader>q fills the quickfix list with pending hunks across buffers, but accept/reject is still buffer-local and cursor-based. :cnext/:cprev gets you there; <leader>a/<leader>x doesn't complete a reliable cross-file review loop.

goal

@LOTaher i was thinking about #11. it would be really nice to be able to open quickfix, cycle hunks (including across files, ideally), accept or reject each one and the list stays in sync and advances automatically.

this happens sort of automatically in cursor, which has my favorite "singleton buffer diff" implementation. it's so nice and seamless, i can have an LLM make edits to several files, and just click through and be sent to the next hunk, regardless of what buffer i am in.

the limitation there though is that you still need to hit "review next file." i think there was some AB test that let some users press tab and instantly be sent to the next file to review by pressing tab, but for some reason i don't recall having that feature anymore and also, even then it was really only when the completion engine detected similar patterns across the files edited in the prompt you made.

anyways, i would love to get an LLM to make a semi-larger edit that spans more than one file, and then being able to use quickfix as my review pipeline. i can just cycle hunks across the files edited and accept/reject.

design

quickfix items should store hunk identity, not just the location:

something like:

{
  bufnr = bufnr,
  lnum = hunk.old_start,
  col = 1,
  text = preview,
  user_data = { bufnr = bufnr, hunk_idx = hunk_idx },
}

sort by filename, then line.

then we can accept/reject by identity. add accept_hunk(bufnr, hunk_idx) / reject_hunk(bufnr, hunk_idx). we can reuse existing apply/clear logic; don't think we need to rely on hunk_at_cursor() for the qf flow.

when acting on the current quickfix entry:

  1. accept/reject via user_data
  2. remove entry from qf list (or rebuild)
  3. :cnext, or close qf when empty

keep existing <leader>a/<leader>x for normal in-buffer use.

optional acceptance

  • map a/x in the quickfix window
  • document <leader>q workflow in README

out of scope

this would work great in multiple files, like i said, but let's focus on just getting this minimally finished.

  • multi-file hunks from a single prompt
  • changing hunk rendering

refs

PR #11

@LOTaher wdyt?

Metadata

Metadata

Assignees

Labels

area:navigationHunk movement, accept/reject flowfeatureNew functionalityuxUser experience or polish

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions