opencode-nvim-diff-review 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lua/diff-review/init.lua +22 -1
- package/opencode-plugin/index.ts +2 -1
- package/package.json +1 -1
package/lua/diff-review/init.lua
CHANGED
|
@@ -270,7 +270,9 @@ function M.on_view_opened(view)
|
|
|
270
270
|
end
|
|
271
271
|
|
|
272
272
|
--- Number of context lines to show above and below a focused hunk.
|
|
273
|
-
|
|
273
|
+
--- This provides enough surrounding code to understand the change without
|
|
274
|
+
--- overwhelming the view with unrelated code.
|
|
275
|
+
local HUNK_CONTEXT = 5
|
|
274
276
|
|
|
275
277
|
--- Apply a pending cursor position and hunk focus after diffview has finished
|
|
276
278
|
--- loading a file. Called from the DiffviewDiffBufWinEnter autocmd and from
|
|
@@ -372,6 +374,20 @@ function M._apply_hunk_focus(view, hunk)
|
|
|
372
374
|
vim.wo.foldmethod = "manual"
|
|
373
375
|
vim.wo.foldenable = true
|
|
374
376
|
|
|
377
|
+
-- Show absolute line numbers so the user can correlate with the
|
|
378
|
+
-- hunk header line ranges (e.g. @@ -273,1 +273,3 @@)
|
|
379
|
+
vim.wo.number = true
|
|
380
|
+
vim.wo.relativenumber = false
|
|
381
|
+
|
|
382
|
+
-- Override the Folded highlight in this window so fold lines don't
|
|
383
|
+
-- look like diff modifications. Uses winhl to scope it to this window.
|
|
384
|
+
local existing_winhl = vim.wo.winhl or ""
|
|
385
|
+
if not existing_winhl:match("Folded:") then
|
|
386
|
+
vim.wo.winhl = existing_winhl
|
|
387
|
+
.. (existing_winhl ~= "" and "," or "")
|
|
388
|
+
.. "Folded:DiffviewDiffFoldedReview"
|
|
389
|
+
end
|
|
390
|
+
|
|
375
391
|
-- Remove all existing folds
|
|
376
392
|
pcall(vim.cmd, "normal! zE")
|
|
377
393
|
|
|
@@ -437,6 +453,11 @@ function M.setup(opts)
|
|
|
437
453
|
_G.DiffviewHunks = DiffviewHunks
|
|
438
454
|
_G.DiffviewGoTo = DiffviewGoTo
|
|
439
455
|
|
|
456
|
+
-- Define a neutral highlight for fold lines in hunk-focus mode.
|
|
457
|
+
-- Links to Comment by default so folds look like muted separators
|
|
458
|
+
-- rather than diff modifications. Users can override this.
|
|
459
|
+
vim.api.nvim_set_hl(0, "DiffviewDiffFoldedReview", { link = "Comment", default = true })
|
|
460
|
+
|
|
440
461
|
-- Listen for diffview's DiffviewDiffBufWinEnter autocmd to apply pending
|
|
441
462
|
-- cursor positions after async file loading completes.
|
|
442
463
|
vim.api.nvim_create_autocmd("User", {
|
package/opencode-plugin/index.ts
CHANGED
|
@@ -120,7 +120,8 @@ const statusLabel = (status: string | undefined): string =>
|
|
|
120
120
|
const formatHunkPosition = (): string => {
|
|
121
121
|
if (reviewQueue.length === 0) return "No review in progress."
|
|
122
122
|
const item = reviewQueue[reviewPosition]
|
|
123
|
-
|
|
123
|
+
const fileCount = new Set(reviewQueue.map(h => h.file)).size
|
|
124
|
+
return `Reviewing: ${item.file} (${statusLabel(item.status)}) ${item.header} — item ${reviewPosition + 1} of ${reviewQueue.length} across ${fileCount} file${fileCount === 1 ? "" : "s"}.`
|
|
124
125
|
}
|
|
125
126
|
|
|
126
127
|
/**
|