Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ Choose `View > Diff > Split` or `View > Diff > Unified`, use Toggle Diff Layout
or set `settings.diffStyle` to `split` for side-by-side diffs or `unified` for unified diffs.
Choose `View > Diff > Word Wrap`, use Toggle Word Wrap in the command bar, or set
`settings.wordWrap` to `true` to wrap long diff lines.
Choose `View > Diff > Expand Unchanged Lines` or set `settings.expandUnchanged` to `true` to show
full files instead of collapsing unchanged lines between hunks.
Choose `View > Diff > Font Size`, use the code font size commands in the command bar, or use
<kbd>Cmd/Ctrl</kbd>+<kbd>+</kbd>, <kbd>Cmd/Ctrl</kbd>+<kbd>-</kbd>, and
<kbd>Cmd/Ctrl</kbd>+<kbd>0</kbd> to change only diff and code rendering font size.
Expand Down
1 change: 1 addition & 0 deletions config/defaults.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"copyCommentsOnClose": false,
"diffStyle": "split",
"editorCommand": "",
"expandUnchanged": false,
"lastRepositoryPath": "",
"openAIModel": "gpt-5.6-terra",
"opencodeModel": "opencode-default",
Expand Down
1 change: 1 addition & 0 deletions core/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1754,6 +1754,7 @@ export default function App() {
diffStyle,
disableWorkerPool: disableCodeViewWorkerPool,
expandedReviewKeys,
expandUnchanged: preferences.expandUnchanged,
focusCommentId,
focusCommentRequest,
gitIdentity,
Expand Down
1 change: 1 addition & 0 deletions core/__tests__/App-render.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ const createCodiffMock = (overrides: Partial<Window['codiff']> = {}): Window['co
copyCommentsOnClose: true,
diffStyle: 'split' as const,
editorCommand: '',
expandUnchanged: false,
lastRepositoryPath: '/repo',
openAIModel: defaultSettings.openAIModel,
opencodeModel: defaultSettings.opencodeModel,
Expand Down
18 changes: 18 additions & 0 deletions core/__tests__/ReviewCodeView-header.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -249,3 +249,21 @@ test('narrow pane layout and sticky header metrics resize together without losin
expect(codeViewMock.lastOptions?.itemMetrics).toEqual({ diffHeaderHeight: 54 });
expect(viewport.style.getPropertyValue('--codiff-file-header-height')).toBe('54px');
});

test('expandUnchanged only expands diffs when full file contents can be loaded', async () => {
const loadContents = vi.fn();
await using view = await renderReact(
<ReviewCodeViewHarness expandUnchanged files={[file]} onLoadSectionContents={loadContents} />,
);
expect(codeViewMock.lastOptions?.expandUnchanged).toBe(true);

await view.rerender(
<ReviewCodeViewHarness
expandUnchanged
files={[file]}
isReadOnly
onLoadSectionContents={loadContents}
/>,
);
expect(codeViewMock.lastOptions?.expandUnchanged).toBe(false);
});
5 changes: 4 additions & 1 deletion core/app/components/ReviewCodeView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2618,6 +2618,7 @@ export function ReviewCodeView({
diffStyle,
disableWorkerPool = false,
expandedReviewKeys = emptyExpandedReviewKeys,
expandUnchanged = false,
files,
focusCommentId,
focusCommentRequest,
Expand Down Expand Up @@ -2681,6 +2682,7 @@ export function ReviewCodeView({
diffStyle: CodiffDiffStyle;
disableWorkerPool?: boolean;
expandedReviewKeys?: ReadonlySet<string>;
expandUnchanged?: boolean;
files: ReadonlyArray<ChangedFile>;
focusCommentId: string | null;
focusCommentRequest: number;
Expand Down Expand Up @@ -3625,7 +3627,7 @@ export function ReviewCodeView({
diffStyle,
enableGutterUtility: !isReadOnly,
enableLineSelection: !isReadOnly,
expandUnchanged: false,
expandUnchanged: expandUnchanged && loadDiffFiles != null,
expansionLineCount: diffContextExpansionLineCount,
hunkSeparators: 'line-info-basic',
itemMetrics,
Expand Down Expand Up @@ -3805,6 +3807,7 @@ export function ReviewCodeView({
cancelPendingEmptyCommentDeletes,
createCommentForRange,
diffStyle,
expandUnchanged,
isReadOnly,
itemMetadata,
itemMetrics,
Expand Down
5 changes: 5 additions & 0 deletions core/config/codiff-config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@
"default": "",
"description": "Command used to open files from Codiff. Use {file} as the file path placeholder, {line} as the optional line number, and {repo} as the repository root placeholder, for example \"subl \\\"{repo}\\\" \\\"{file}\\\"\", or leave empty to use Codiff's default editor lookup."
},
"expandUnchanged": {
"type": "boolean",
"default": false,
"description": "Show full files in diffs instead of collapsing unchanged lines between hunks."
},
"lastRepositoryPath": {
"type": "string",
"default": "",
Expand Down
1 change: 1 addition & 0 deletions core/config/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export type CodiffSettings = {
copyCommentsOnClose: boolean;
diffStyle: CodiffDiffStyle;
editorCommand: string;
expandUnchanged: boolean;
lastRepositoryPath: string;
openAIModel: string;
opencodeModel: string;
Expand Down
1 change: 1 addition & 0 deletions core/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,7 @@ export type CodiffPreferences = {
copyCommentsOnClose: boolean;
diffStyle: CodiffDiffStyle;
editorCommand: string;
expandUnchanged: boolean;
lastRepositoryPath: string;
openAIModel: string;
opencodeModel: string;
Expand Down
4 changes: 4 additions & 0 deletions electron/config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,10 @@ const mergeConfig = (raw) => {
typeof rawSettings.editorCommand === 'string'
? rawSettings.editorCommand
: defaults.settings.editorCommand,
expandUnchanged:
typeof rawSettings.expandUnchanged === 'boolean'
? rawSettings.expandUnchanged
: defaults.settings.expandUnchanged,
lastRepositoryPath: normalizeLastRepositoryPath(rawSettings.lastRepositoryPath),
openAIModel:
typeof rawSettings.openAIModel === 'string'
Expand Down
10 changes: 10 additions & 0 deletions electron/main.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,16 @@ const buildApplicationMenu = () =>
label: 'Show Whitespace',
type: 'checkbox',
},
{
checked: config.settings.expandUnchanged,
click: (menuItem) => {
updateConfig({
settings: { ...config.settings, expandUnchanged: menuItem.checked },
});
},
label: 'Expand Unchanged Lines',
type: 'checkbox',
},
{ type: 'separator' },
{
label: 'Font Size',
Expand Down