resolvedなコメントの表示/非表示を切り替えるFudeReviewToggleResolvedを追加 - #163
Merged
Conversation
kyu08
force-pushed
the
feat/comment-resolved-label
branch
from
July 21, 2026 10:40
ac4cf9c to
a71dcad
Compare
3 tasks
- config: state.show_resolved runtime override with get_show_resolved()/toggle_show_resolved() (current_comment_style pattern; editor-only, resets on stop) - data: build_comment_map/merge_pending_into_comments accept opts.hide_resolved to exclude resolved comments from the map, hiding them from extmarks, navigation, and the comment viewer; the comment browser stays unaffected - sync: comment_map is built with the current visibility so the toggle survives reloads - comments: toggle_resolved_visibility() rebuilds comment_map and refreshes extmarks; wired to the new user command - fix: apply_thread_info no longer marks unsubmitted pending comments as resolved — a pending reply on a resolved thread must keep the line unresolved (and never be hidden by the toggle) - extmarks: build inline opts only in inline mode Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Local review mode marks threads with a thread-level `resolved` flag (FudeReviewResolve) instead of GitHub's `is_resolved`. Make build_comment_map's hide_resolved cover both fields and thread the current visibility through local_sync's re-materialize so the toggle behaves the same in both backends. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
kyu08
force-pushed
the
feat/toggle-resolved-comments
branch
from
July 22, 2026 01:28
239926e to
4574296
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
:FudeReviewToggleResolved を追加し、GitHub 上で resolve 済み(およびローカルレビューで resolved 済み)のスレッドを エディタ表示(extmarks / ナビゲーション / comment viewer)からランタイムで表示・非表示切り替えできるようにする変更です。comment_map を単一のフィルタリングポイントにして、reload/auto-reload/ローカル操作後もトグル状態が維持されるように統合されています。
Changes:
config.state.show_resolvedとget_show_resolved()/toggle_show_resolved()を追加し、セッション中の表示状態を保持comments/data.luaのbuild_comment_mapにhide_resolvedを導入し、resolved フィルタを comment_map 構築に集約- GitHub resolved スレッド上の 未送信 pending reply には
is_resolvedを付与しないようにして、誤って [resolved] 扱い・非表示になるのを回避
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
plugin/fude.lua |
:FudeReviewToggleResolved コマンド追加と無効化設定時の警告 |
lua/fude/config.lua |
show_resolved の runtime state と get/toggle API 追加、reset でクリア |
lua/fude/comments/data.lua |
build_comment_map(..., { hide_resolved }) による resolved フィルタの一元化 |
lua/fude/comments.lua |
toggle_resolved_visibility() を追加し comment_map 再構築+extmarks 更新 |
lua/fude/comments/sync.lua |
comment_map 構築へ可視性反映、pending reply へ resolved 伝播しない修正 |
lua/fude/comments/local_sync.lua |
comment_map 構築へ可視性反映(ローカル resolved も対象) |
lua/fude/ui/extmarks.lua |
inline 用オプション構築を inline 時に限定(挙動維持の整理) |
tests/fude/config_spec.lua |
get_show_resolved / toggle_show_resolved / reset のユニットテスト追加 |
tests/fude/comments_spec.lua |
hide_resolved フィルタと toggle_resolved_visibility の挙動テスト追加 |
tests/fude/sync_integration_spec.lua |
reload 維持・pending reply 除外の統合テスト追加 |
README.md |
コマンド一覧・resolved 設定説明へトグル追記 |
doc/fude.txt |
:FudeReviewToggleResolved のヘルプ追記と設定節への補足 |
CLAUDE.md |
アーキテクチャ/状態依存一覧の追記・整合 |
kyu08
commented
Jul 22, 2026
| - **`comments.lua`** — Facade module re-exporting `comments/data.lua`, `comments/sync.lua`, and `comments/pickers.lua`. Contains comment navigation (`next_comment`/`prev_comment`), creation (`create_comment`/`suggest_change`), viewing (`view_comments`), reply (`reply_to_comment`), editing (`edit_comment`), deletion (`delete_comment`), and thread resolution (`toggle_resolve`, local mode only). Dispatches mutations to `comments/sync.lua` (GitHub) or `comments/local_sync.lua` (local JSONL) by `state.review_mode`. Also provides ownership helpers: `is_own_comment`, `is_pending_comment`, `find_pending_key`, and `toggle_resolved_visibility()` (flips `config.toggle_show_resolved()`, rebuilds `comment_map` from `state.comments` with `hide_resolved`, and refreshes extmarks — used by `:FudeReviewToggleResolved`; the comment browser is unaffected). `require("fude.comments")` is the public interface. | ||
| - **`comments/data.lua`** — Pure data functions with no state or side effects: `line_from_diff_hunk`, `build_comment_map`, `find_next_comment_line`, `find_prev_comment_line`, `find_comment_by_id`, `get_comment_thread`, `parse_draft_key`, `build_pending_comments_from_review`, `build_review_comment_object`, `merge_pending_into_comments`, `pending_comments_to_array`, `get_comment_line_range`, `get_reply_target_id`, `get_comments_at`, `get_comment_lines`, `build_comment_entries`, `build_comment_browser_entries`, `merge_draft_entries` (flags existing entries with `has_draft` for matching reply/edit/line/issue drafts and appends `type="draft"` rows for new line/suggest/issue drafts, then re-sorts by `last_ts`). | ||
| - **`comments/sync.lua`** — GitHub API sync/submit operations: `load_comments`, `sync_pending_review`, `submit_as_review`, `reply_to_comment`, `edit_comment`, `delete_comment`. `load_comments` is the main entry point: detects pending review via `GET /pulls/{pr}/reviews`, then fetches both submitted comments (`GET /pulls/{pr}/comments`) and pending review comments (`GET /reviews/{id}/comments`) in a single flow, converting `position` to `line` via `line_from_diff_hunk` and building both `comment_map` and `pending_comments`. Also fetches review threads via GraphQL (skipped when `outdated.show` and `resolved.show` are both false and no pending review exists) and applies `is_outdated` (root comments only, gated by `outdated.show`) and `is_resolved` (per-thread state, propagated to replies via `in_reply_to_id`, gated by `resolved.show`) to comment objects. Internal `fetch_comments` is used by other functions for refreshing after mutations. Uses lazy `require("fude.ui")` to avoid circular dependencies. | ||
| - **`comments/sync.lua`** — GitHub API sync/submit operations: `load_comments`, `sync_pending_review`, `submit_as_review`, `reply_to_comment`, `edit_comment`, `delete_comment`. `load_comments` is the main entry point: detects pending review via `GET /pulls/{pr}/reviews`, then fetches both submitted comments (`GET /pulls/{pr}/comments`) and pending review comments (`GET /reviews/{id}/comments`) in a single flow, converting `position` to `line` via `line_from_diff_hunk` and building both `comment_map` and `pending_comments`. Also fetches review threads via GraphQL (skipped when `outdated.show` and `resolved.show` are both false and no pending review exists) and applies `is_outdated` (root comments only, gated by `outdated.show`) and `is_resolved` (per-thread state, propagated to replies via `in_reply_to_id`, gated by `resolved.show`) to comment objects. `comment_map` is built with `hide_resolved = not config.get_show_resolved()` so the runtime resolved-visibility toggle survives reloads. Internal `fetch_comments` is used by other functions for refreshing after mutations. Uses lazy `require("fude.ui")` to avoid circular dependencies. |
The toggle previously removed resolved comments from comment_map, which also hid them from navigation, the comment viewer, and the comment browser. Restrict it to inline comment boxes only: - comment_map always keeps resolved comments (build_comment_map and merge_pending_into_comments no longer take hide_resolved); navigation, the comment viewer, the virtualText style, and the comment browser are unaffected - refresh_extmarks factors the EOL indicators into render_virt_text_indicators, reused so a resolved comment whose inline box is hidden falls back to the same virtualText indicator ([resolved] + count) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
When FudeReviewToggleResolved hid a resolved comment's inline box, the EOL fallback judged `[resolved]` over only the hidden subset, so a line mixing an unresolved thread with a resolved one wrongly showed `[resolved]`. Render the fallback only when the whole line has no box, so render_virt_text_indicators judges over all of the line's comments like the virtualText style. Also split box/fallback on `is_resolved` alone (matching util.all_comments_resolved) so they never disagree. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…l set) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Comment on lines
+59
to
+63
| --- Only affects inline comment boxes (the virt_lines rendered in "inline" | ||
| --- comment style): refresh_extmarks skips resolved comments when hidden. | ||
| --- comment_map is left intact, so navigation, the comment viewer, virtualText | ||
| --- indicators, and the comment browser (FudeReviewListComments) always show | ||
| --- resolved threads regardless of this toggle. |
Comment on lines
+162
to
+167
| -- Inline mode: display full comment content below the line. | ||
| -- When FudeReviewToggleResolved is off, resolved comments do not get an | ||
| -- inline box. If that leaves the line with nothing to show, it falls back | ||
| -- to the same EOL virtualText indicator the virtualText style would show | ||
| -- (e.g. `[resolved] 🗒️1`) so the line stays marked. Pending comments are | ||
| -- never resolved, so they always keep their inline box. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
resolvedなコメントのエディタ表示をランタイムでトグルする
:FudeReviewToggleResolvedを追加します(Closes #103)。#73(PR #156)で導入したresolvedラベル表示が前提のため、base branchをfeat/comment-resolved-labelにしたstacked PRです。#156のマージ後にbaseをmainへ切り替えてください。変更内容
config.lua:state.show_resolved(runtime override、current_comment_styleパターン)とget_show_resolved()/toggle_show_resolved()を追加。セッション終了でリセットcomments/data.lua:build_comment_map(comments, opts)にopts.hide_resolvedを追加。comment_mapがextmarks・]c/[cナビゲーション・コメントviewerの共通データ源のため、ここで一元フィルタ。GitHubのis_resolvedとローカルレビューのresolved(:FudeReviewResolveでresolveしたスレッド)の両方を対象にするcomments/sync.lua/comments/local_sync.lua: comment_map構築時に現在の可視性を渡し、reload・auto-reload・ローカル操作後もトグル状態を維持comments.lua:toggle_resolved_visibility()(comment_map再構築+extmarks更新)plugin/fude.lua::FudeReviewToggleResolvedコマンド。resolved.show = false(キルスイッチ)時は警告のみ:FudeReviewListComments)は影響を受けず、常に[resolved]ラベル付きで表示する(outdatedの前例と一貫)また、レビューで検出した#156のエッジケースをあわせて修正しています:
is_resolvedが伝播し、未送信コメントが残る行が[resolved]表示になっていました。トグルで自分の未送信リプライごと非表示になる事故も防ぐため、pendingコメントにはis_resolvedを付けないようにしましたテスト計画
make all: luacheck / stylua / 全spec / check-state-deps / check-purity / check-docs)config_spec(get/toggle)、comments_spec(hide_resolvedフィルタ・ローカルresolved対応・toggle_resolved_visibility)、sync_integration_spec(reload後の維持・pending除外):FudeReviewToggleResolvedを実行し、(a) virtualText/inlineインジケーターと]c/[cから消えること、(b) ブラウザには残ること、(c):FudeReviewReload後も非表示が維持されること、(d) ローカルレビューで:FudeReviewResolveしたスレッドにも効くこと備考
state.comments(未フィルタ)由来のためトグルの影響を受けませんGenerated with Claude Code