Skip to content

Commit f2dd45a

Browse files
authored
docs(recipes): add PR review progress tracking recipe (#86)
1 parent 03e7f50 commit f2dd45a

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

RECIPES.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,49 @@ Open with a symmetric range to see only the changes introduced by the branch:
112112

113113
</details>
114114

115+
<details>
116+
<summary><b>PR Review Progress Tracking</b></summary>
117+
118+
Use file selections (`<Space>` key) to track which files you've reviewed.
119+
Selected files show a `` indicator; directories show `` when all
120+
files are selected or `` when some are.
121+
122+
To persist your progress across Neovim restarts, enable
123+
`persist_selections`:
124+
125+
```lua
126+
require("diffview").setup({
127+
persist_selections = { enabled = true },
128+
})
129+
```
130+
131+
The `DiffviewSelectionChanged` User autocmd fires whenever selections
132+
change, allowing external plugins to react:
133+
134+
```lua
135+
-- Example: log selection changes (replace with your own integration).
136+
vim.api.nvim_create_autocmd("User", {
137+
pattern = "DiffviewSelectionChanged",
138+
callback = function()
139+
local view = require("diffview.lib").get_current_view()
140+
if not view then return end
141+
local selected = view.panel:get_selected_files()
142+
local paths = vim.tbl_map(function(f) return f.path end, selected)
143+
vim.notify(
144+
#paths > 0
145+
and ("Reviewed: " .. table.concat(paths, ", "))
146+
or "No files marked as reviewed"
147+
)
148+
end,
149+
})
150+
```
151+
152+
This pattern works for integrating with any external review tool. When
153+
the tool's API supports marking files as viewed (e.g., GitLab, GitHub),
154+
the autocmd handler can sync the selection state.
155+
156+
</details>
157+
115158
<details>
116159
<summary><b>Better Diffs</b></summary>
117160

0 commit comments

Comments
 (0)