-
Notifications
You must be signed in to change notification settings - Fork 1
feat: 空白差分の表示/非表示を切り替える FudeReviewToggleWhitespace コマンドの追加 #116
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -708,6 +708,26 @@ function M.restore_gitsigns_base() | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| end | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| end | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| --- Toggle whitespace diff ignore (iwhite). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| --- When enabled, whitespace-only changes are hidden from the diff view. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| function M.toggle_iwhite() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| local state = config.state | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if not state.active then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| vim.notify("fude.nvim: Not active", vim.log.levels.WARN) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| end | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if state.iwhite then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| state.iwhite = false | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| vim.opt.diffopt:remove("iwhite") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| vim.notify("fude.nvim: Whitespace diff ON", vim.log.levels.INFO) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| state.iwhite = true | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| vim.opt.diffopt:append("iwhite") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+720
to
+726
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if state.iwhite then | |
| state.iwhite = false | |
| vim.opt.diffopt:remove("iwhite") | |
| vim.notify("fude.nvim: Whitespace diff ON", vim.log.levels.INFO) | |
| else | |
| state.iwhite = true | |
| vim.opt.diffopt:append("iwhite") | |
| local diffopt = vim.opt.diffopt:get() | |
| local has_iwhite = false | |
| for _, opt in ipairs(diffopt) do | |
| if opt == "iwhite" then | |
| has_iwhite = true | |
| break | |
| end | |
| end | |
| -- Sync internal state with the actual current diffopt value before toggling. | |
| state.iwhite = has_iwhite | |
| if has_iwhite then | |
| vim.opt.diffopt:remove("iwhite") | |
| state.iwhite = false | |
| vim.notify("fude.nvim: Whitespace diff ON", vim.log.levels.INFO) | |
| else | |
| vim.opt.diffopt:append("iwhite") | |
| state.iwhite = true |
Copilot
AI
Apr 3, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
toggle_iwhite() の追加に対するテストが見当たりません。diffopt の変更/復元(特に stop 時に元へ戻ること、既に iwhite が入っている初期状態でのトグル挙動)を tests/fude/init_integration_spec.lua 等でカバーするテストを追加してください。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
この実装だと
config.opts.diffopt = nil(ユーザー既定の diffopt を維持する設定)の場合にstate.original_diffoptが保存されないため、toggle_iwhite()によるdiffopt変更が:FudeReviewStopで復元されずに残ります。toggle_iwhite()実行前(または review start 時)に必ずoriginal_diffoptを退避するようにして、停止時に確実に元へ戻るようにしてください。