feat: ファイル変更差分表示の追加#22
Merged
Merged
Conversation
- Add getSessionDiff() method to OpenCodeClient - Add getSessionDiff/openDiffEditor message handlers in ChatViewProvider - Register opencode-diff-before/after TextDocumentContentProviders - Export FileDiff type from opencode-client
- Add sessionDiff, getSessionDiff, openDiffEditor message types - Add fileChanges.* locale strings (en/ja) - Add DiffIcon and ExternalLinkIcon components
- Handle session.diff SSE events - Provide diffs/setDiffs/clearDiffs/handleFileChangeEvent
- TodoHeader-style collapsible bar with file count and stats - Per-file items with status badge (A/D/M), inline diff, open button - Expandable inline DiffView for each file
- Wire useFileChanges hook and sessionDiff message handling in App - Add fileDiffs/onOpenDiffEditor to AppContext - Render FileChangesHeader below TodoHeader above InputArea
- Add DiffIcon/ExternalLinkIcon to icons unit tests (+16 tests) - Add FileChangesHeader unit tests (22 tests) - Add useFileChanges hook tests (5 tests) - Add scenario test 15-file-changes (12 tests)
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.
Summary
セッションレベルのファイル変更差分を表示する機能を追加。SDK の
session.diff()API を利用し、TodoHeader と同様の折りたたみバー UI で変更ファイル一覧・インライン差分・VS Code ネイティブ diff エディタへの連携を提供する。Related Issue
Closes #16
Changes
バックエンド(Extension Host)
opencode-client.ts:getSessionDiff()メソッド追加、FileDiff型のエクスポートchat-view-provider.ts:getSessionDiff/openDiffEditorメッセージハンドラ追加extension.ts:opencode-diff-before/opencode-diff-afterTextDocumentContentProvider 登録メッセージ型・共通
vscode-api.ts:sessionDiff(Ext→Webview)、getSessionDiff/openDiffEditor(Webview→Ext)メッセージ型追加locales/en.ts,locales/ja.ts:fileChanges.*ロケール文字列追加icons.tsx:DiffIcon,ExternalLinkIcon追加Webview
useFileChangesフック:session.diffSSE イベントで差分データを管理FileChangesHeaderコンポーネント: TodoHeader 風の折りたたみバー UIApp.tsx: フック統合、sessionDiffメッセージ処理、TodoHeader の下に FileChangesHeader を配置AppContext.tsx:fileDiffs/onOpenDiffEditor追加テスト
icons.test.tsx: DiffIcon / ExternalLinkIcon 単体テスト(+16)FileChangesHeader.test.tsx: コンポーネント単体テスト(22)useFileChanges.test.ts: フック単体テスト(5)15-file-changes.test.tsx: シナリオテスト(12)Checklist
npm run buildpassesnpm testpasses (52 files, 709 tests)