Skip to content

feat: 変更ファイル間を移動するコマンドを追加#129

Merged
flexphere merged 4 commits into
flexphere:mainfrom
lugen4ro:feat/next-prev-file-navigation
Apr 28, 2026
Merged

feat: 変更ファイル間を移動するコマンドを追加#129
flexphere merged 4 commits into
flexphere:mainfrom
lugen4ro:feat/next-prev-file-navigation

Conversation

@lugen4ro
Copy link
Copy Markdown
Collaborator

@lugen4ro lugen4ro commented Apr 28, 2026

なぜ

レビュー中、変更ファイル間を一発で移動したい場面が多い。
preview panel や file finder だと「開く → 戻る → また開く」のサイクルが要り、
レビューの流れが途切れる。

何を

  • :FudeReviewNextFile / :FudeReviewPrevFile を追加(最後のファイルで wrapして先頭に戻る)
  • Lua API として require("fude.files").next_file() / prev_file() を公開。
    キーマップは利用者の好みに委ねる
  • ]f[f キーマップを README の example config に追加。

確認内容

問題なく次の差分のあるファイル・前のファイルを表示できること。

CleanShot2026-04-28at10.08.09.mp4

また、スコープがある場合は、そのスコープ内のファイルに限定されることも確認済み。

Expose next_file/prev_file in fude.files plus :FudeReviewNextFile and
:FudeReviewPrevFile commands so users can jump between PR-changed files
with a single keymap. Wraps around at the edges and falls back to the
first/last entry when the current buffer is not part of the PR.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 28, 2026 01:02
@lugen4ro lugen4ro marked this pull request as ready for review April 28, 2026 01:13
@kyu08 kyu08 requested review from Copilot and removed request for Copilot April 28, 2026 01:28
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

レビュー中に「差分のある次/前のファイル」へ素早く移動できるように、変更ファイル間ナビゲーション用のコマンドとLua APIを追加するPRです。

Changes:

  • :FudeReviewNextFile / :FudeReviewPrevFile ユーザーコマンドを追加
  • Lua API として require("fude.files").next_file() / prev_file() と、純関数ヘルパ find_adjacent_file_index() を追加
  • README / helptags / 開発ドキュメント(CLAUDE.md)/ テストを更新

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/fude/files_spec.lua 隣接ファイル計算と next/prev 移動のテストを追加
plugin/fude.lua Next/Prev ファイル移動コマンドを登録
lua/fude/files.lua 隣接ファイル計算ロジックと next/prev 移動APIを実装
doc/fude.txt 新コマンドのヘルプを追加
README.md lazy.nvim例・コマンド一覧に新コマンドを追記
CLAUDE.md files.lua の責務説明に next/prev 移動機能を追記

Comment thread lua/fude/files.lua Outdated
Comment thread lua/fude/files.lua
Comment thread tests/fude/files_spec.lua Outdated
lugen4ro and others added 3 commits April 28, 2026 10:59
to_repo_relative re-runs git rev-parse internally; since goto_adjacent
already has the repo root, use the pure make_relative helper to compute
the buffer's repo-relative path without spawning git twice.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The previous integration tests called the real :edit command, leaking
buffers that helpers.cleanup did not track. Mock vim.cmd to capture the
edit command string and assert against it directly. Also assert the
captured command is nil on the early-return paths so the defense checks
actually verify nothing was opened.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Add two lessons surfaced by Copilot's review on PR flexphere#129: avoiding
helper chains that re-fetch already-cached values, and using a vim.cmd
mock instead of letting tests open real buffers via :edit.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 28, 2026 02:27
@flexphere flexphere merged commit 4f4dc29 into flexphere:main Apr 28, 2026
5 checks passed
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.

3 participants