Skip to content

fix: サイドパネルのFilesをGitHubのPRファイルツリーと同じ順に並べる - #234

Merged
kyu08 merged 4 commits into
mainfrom
fix/sidepanel-file-order
Oct 9, 2026
Merged

kyu08 merged 4 commits into
mainfrom
fix/sidepanel-file-order

Conversation

@kyu08

@kyu08 kyu08 commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

概要

サイドパネルのFiles(flat/tree)を、GitHubのPRのファイルツリーと同じ順に並べる。これまでtree表示はディレクトリを優先して名前順に並べていたため、flat表示ともGitHubとも順序が違っていた。

Closes #214

変更内容

  • tree表示の子要素を、入力に最初に出てきた順で並べるようにした(lua/fude/ui/sidepanel/tree.lua)
    • GitHubのファイルツリーは、diff一覧の順(フルパスのバイト順)のまま階層化したもので、ディレクトリを優先しない。PR #231ではCLAUDE.mdがlua/より前に、ui.luaがui/より前に並ぶ
    • パス順のchanged_filesをtreeにしてから平坦化すると元のflat順と同じになるので、tree modeでのnext/prev fileの移動順もflatと一致する
  • local modeのchanged_filesをパスのバイト順でソートするようにした(lua/fude/local/session.lua)
    • これまでuntrackedファイルはgit diffの結果の末尾に追加されていたため、flat表示ではuntrackedファイルだけがパス順から外れていた
    • 比較にはutil.path_lessを追加した。PUC Luaの<はロケールに依存するstrcollで比較するため、バイト単位で比べる処理を明示的に書いた
  • GitHub modeのchanged_filesはソートせず、APIが返す順をそのまま使う
    • pulls/{pr}/filesの順がweb表示の順と一致することをPR #231で確認した。renameされたファイルをソートし直すと、かえってGitHubと順序がずれるおそれがある

テスト計画

  • 既存テスト全パス (make all)
  • 新規テスト追加: tests/fude/sidepanel_tree_spec.lua, tests/fude/files_spec.lua, tests/fude/local_session_spec.lua, tests/fude/util_spec.lua

備考

renameを含むPRで、GitHub上の並びと一致するかはまだ確認していない。


Generated with Claude Code

Copilot AI balanced review requested due to automatic review settings October 9, 2026 15:18
@kyu08
kyu08 marked this pull request as ready for review October 9, 2026 15:18

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.

🟢 Approval recommended

実装、ナビゲーション、テスト、ドキュメントが一貫しており、未解決の問題は見つかりませんでした。

0 open findings

What changed in this PR

サイドパネルのファイル順をGitHub PR表示に合わせ、flat/tree間の一貫性を改善します。

Changes:

  • tree表示を入力順ベースへ変更
  • local modeをパスのバイト順でソート
  • テストとドキュメントを更新
File Description
lua/​fude/​ui/​sidepanel/​tree.lua 子要素の入力順を維持
lua/​fude/​local/​session.lua local変更ファイルをソート
lua/​fude/​util.lua バイト順比較を追加
lua/​fude/​files.lua ナビゲーション説明を更新
tests/​fude/​sidepanel_tree_spec.lua tree順序を検証
tests/​fude/​sidepanel_integration_spec.lua 折り畳み動作を追従
tests/​fude/​local_session_spec.lua localソートを検証
tests/​fude/​util_spec.lua パス比較を検証
tests/​fude/​files_spec.lua ナビゲーション順を検証
README.md 表示順を文書化
doc/​fude.txt ヘルプを更新
CLAUDE.md アーキテクチャ説明を更新

🧠 Review effort: Balanced


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

local M = {}
local config = require("fude.config")
local store = require("fude.local.store")
local util = require("fude.util")

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

test single line comment

Comment on lines +101 to +103
--- git output. Untracked files are added as "added" with zero counts, and the
--- result is sorted by path in byte order, as the GitHub PR file list is, so
--- untracked files sit among the tracked ones instead of trailing them.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

test multiple line comment

Copilot AI balanced review requested due to automatic review settings October 9, 2026 15:36
@kyu08
kyu08 force-pushed the fix/sidepanel-file-order branch from 11025e9 to b91063e Compare October 9, 2026 15:36
@kyu08
kyu08 merged commit e85e5c2 into main Oct 9, 2026
10 checks passed
@kyu08
kyu08 deleted the fix/sidepanel-file-order branch October 9, 2026 15:37

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.

🟡 Changes recommended

GitHub mode の実装より強い順序保証が README とヘルプ文書に記載されています。

2 open findings

🧠 Review effort: Balanced

Comment thread README.md
Comment on lines +302 to +305
Files are ordered as in the GitHub PR file tree: by path in byte order
(`CLAUDE.md` before `lua/`, `ui.lua` before `ui/`). Tree mode places each
directory where its first file appears, so flat and tree modes list files in
the same order.
Comment thread doc/fude.txt
Comment on lines +762 to +766
Files are ordered as in the GitHub PR file tree: by path in byte
order (`CLAUDE.md` before `lua/`, `ui.lua` before `ui/`). Tree mode
places each directory where its first file appears, so flat and
tree modes list files in the same order. In local review,
untracked files are sorted in among the tracked ones.
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.

PanelのFilesの並び順をGitHub UIと同様にする

2 participants