Skip to content

feat: FudeReviewScopeNext, FudeReviewScopePrevによるscopeの前後移動でも最初のファイルを開く - #192

Merged
kyu08 merged 2 commits into
mainfrom
change-scope
Sep 25, 2026
Merged

kyu08 merged 2 commits into
mainfrom
change-scope

Conversation

@kyu08

@kyu08 kyu08 commented Sep 25, 2026

Copy link
Copy Markdown
Collaborator

概要

:FudeReviewScopeNext/:FudeReviewScopePrevでscopeを切り替えたときも、サイドパネルの<CR>でscopeを選んだときと同じように、新しいscopeの最初のファイルを開くようにする。

変更内容

  • scope.next_scope/prev_scopeがapply_full_pr_scope/apply_commit_scopeにon_doneを渡すようにした
    • これまではon_doneを渡していなかったため、scope切替は成功してもファイルを開く処理が呼ばれていなかった
    • 切替中にユーザーが別の窓へフォーカスを移した場合は開かない。サイドパネル側の「フォーカスがパネルに残っているときだけ開く」判定と同じ考え方にした
    • プレビュー窓から呼んだ場合は、切替中にrefresh_previewがプレビュー窓を作り直して窓番号が変わるため、作り直した後のプレビュー窓にいれば開く
  • files.open_first_file()を追加した
    • sidepanel.open_first_fileはパネルが開いていてフォーカスがある前提なので、ソース窓から呼ばれる[s/]s用に別途用意した
    • 並び順は]Fなどのファイル移動と同じ(tree表示中はtree順)で、削除済みファイルは飛ばす。パネル・プレビューから呼ばれた場合はソース窓に移ってから開く

動作確認

  • make all(lint・format-check・テスト)が通ることを確認した

Copilot AI lite review requested due to automatic review settings September 25, 2026 09:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

Prevent file opening from replacing floating or UI buffers when scope navigation starts there.

Review effort: Lite
Findings: None

What changed in this PR

Adds automatic opening of the first file after switching review scopes.

Changes:

  • Added completion callbacks to scope navigation.
  • Added files.open_first_file() with navigation-order handling.
  • Updated tests and documentation.
File Summary
tests/​fude/​scope_spec.lua Tests scope-switch callbacks.
tests/​fude/​files_spec.lua Tests opening the first file.
README.md Updated command documentation.
lua/​fude/​scope.lua Opens a file after scope changes.
lua/​fude/​files.lua Implements first-file opening; floating or non-empty-buffer origins need handling.
doc/​fude.txt Updated help documentation.
CLAUDE.md Updated architecture documentation.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Copilot AI review requested due to automatic review settings September 25, 2026 09:38
@kyu08

kyu08 commented Sep 25, 2026

Copy link
Copy Markdown
Collaborator Author

レビューのoverviewにあった「floating windowやUI用バッファからscope移動を始めたとき、そのバッファがファイルで置き換わる」件は 9efc886 で対応した。files.open_first_file() は、現在の窓がfloating window(relative ~= "")またはbuftypeが空でないバッファ(quickfix・helpなど)の場合も、サイドパネル・プレビューと同様に sidepanel.find_target_window で選んだソース窓へ移ってから開く。テストも追加した。

@kyu08 kyu08 changed the title feat: scopeの前後移動でも最初のファイルを開く feat: [s, ]sによるscopeの前後移動でも最初のファイルを開く Sep 25, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

削除済みファイルの"deleted"ステータスが除外されず、存在しないパスを開く可能性があります。

Review effort: Lite
Findings: None

@kyu08

kyu08 commented Sep 25, 2026

Copy link
Copy Markdown
Collaborator Author

削除済みファイルのstatusはGitHub APIでは"removed"で、localモードでもDを"removed"に変換している(local/session.lua)。"deleted"という値は使われておらず、open_first_fileが使うsidepanel.find_first_file_entryは"removed"を除外済みのため、対応不要と判断した。

@kyu08
kyu08 marked this pull request as ready for review September 25, 2026 09:43
@kyu08
kyu08 requested a review from flexphere as a code owner September 25, 2026 09:43
@kyu08 kyu08 changed the title feat: [s, ]sによるscopeの前後移動でも最初のファイルを開く feat: FudeReviewScopeNext , FudeReviewScopePrevによるscopeの前後移動でも最初のファイルを開く Sep 25, 2026
@kyu08 kyu08 changed the title feat: FudeReviewScopeNext , FudeReviewScopePrevによるscopeの前後移動でも最初のファイルを開く feat: FudeReviewScopeNext, FudeReviewScopePrevによるscopeの前後移動でも最初のファイルを開く Sep 25, 2026
@kyu08
kyu08 merged commit e40fc99 into main Sep 25, 2026
10 checks passed
@kyu08
kyu08 deleted the change-scope branch September 25, 2026 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants