Skip to content
Draft
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
26 changes: 26 additions & 0 deletions src/vs/editor/browser/widget/diffEditor/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,32 @@ export class ToggleUseInlineViewWhenSpaceIsLimited extends Action2 {

const diffEditorCategory: ILocalizedString = localize2('diffEditor', "Diff Editor");

export class ToggleDiffSideBySide extends Action2 {
constructor() {
super({
id: 'diffEditor.toggleDiffSideBySide',
title: localize2('toggleDiffSideBySide', 'Toggle Inline View'),
icon: Codicon.splitHorizontal,
toggled: EditorContextKeys.diffEditorInlineMode.toNegated(),
precondition: ContextKeyExpr.has('isInDiffEditor'),
f1: true,
category: diffEditorCategory,
menu: {
when: ContextKeyExpr.has('isInDiffEditor'),
id: MenuId.EditorTitle,
order: 21,
group: 'navigation',
},
});
}

run(accessor: ServicesAccessor, ...args: unknown[]): void {
const configurationService = accessor.get(IConfigurationService);
const newValue = !configurationService.getValue<boolean>('diffEditor.renderSideBySide');
configurationService.updateValue('diffEditor.renderSideBySide', newValue);
}
}

export class SwitchSide extends EditorAction2 {
constructor() {
super({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/

import { Codicon } from '../../../../base/common/codicons.js';
import { AccessibleDiffViewerNext, AccessibleDiffViewerPrev, CollapseAllUnchangedRegions, ExitCompareMove, RevertHunkOrSelection, ShowAllUnchangedRegions, SwitchSide, ToggleCollapseUnchangedRegions, ToggleShowMovedCodeBlocks, ToggleUseInlineViewWhenSpaceIsLimited } from './commands.js';
import { AccessibleDiffViewerNext, AccessibleDiffViewerPrev, CollapseAllUnchangedRegions, ExitCompareMove, RevertHunkOrSelection, ShowAllUnchangedRegions, SwitchSide, ToggleCollapseUnchangedRegions, ToggleDiffSideBySide, ToggleShowMovedCodeBlocks, ToggleUseInlineViewWhenSpaceIsLimited } from './commands.js';
import { EditorContextKeys } from '../../../common/editorContextKeys.js';
import { localize } from '../../../../nls.js';
import { MenuId, MenuRegistry, registerAction2 } from '../../../../platform/actions/common/actions.js';
Expand All @@ -15,6 +15,7 @@ import './registrations.contribution.js';
registerAction2(ToggleCollapseUnchangedRegions);
registerAction2(ToggleShowMovedCodeBlocks);
registerAction2(ToggleUseInlineViewWhenSpaceIsLimited);
registerAction2(ToggleDiffSideBySide);

MenuRegistry.appendMenuItem(MenuId.EditorTitle, {
command: {
Expand Down