Skip to content

Commit 802bd40

Browse files
committed
1 parent fe8d9d2 commit 802bd40

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

src/vs/workbench/browser/parts/editor/editor.contribution.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, { command: { id: editorCo
436436
MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, { command: { id: editorCommands.SPLIT_EDITOR_RIGHT, title: nls.localize('splitRight', "Split Right") }, group: '5_split', order: 40 });
437437

438438
// Editor Title Menu
439-
MenuRegistry.appendMenuItem(MenuId.EditorTitle, { command: { id: editorCommands.TOGGLE_DIFF_INLINE_MODE, title: nls.localize('toggleSideBySideView', "Toggle Side By Side View") }, group: '1_diff', order: 10, when: ContextKeyExpr.has('isInDiffEditor') });
439+
MenuRegistry.appendMenuItem(MenuId.EditorTitle, { command: { id: editorCommands.TOGGLE_DIFF_SIDE_BY_SIDE, title: nls.localize('toggleSideBySideView', "Toggle Side By Side View") }, group: '1_diff', order: 10, when: ContextKeyExpr.has('isInDiffEditor') });
440440
MenuRegistry.appendMenuItem(MenuId.EditorTitle, { command: { id: editorCommands.SHOW_EDITORS_IN_GROUP, title: nls.localize('showOpenedEditors', "Show Opened Editors") }, group: '3_open', order: 10, when: ContextKeyExpr.has('config.workbench.editor.showTabs') });
441441
MenuRegistry.appendMenuItem(MenuId.EditorTitle, { command: { id: editorCommands.CLOSE_EDITORS_IN_GROUP_COMMAND_ID, title: nls.localize('closeAll', "Close All") }, group: '5_close', order: 10, when: ContextKeyExpr.has('config.workbench.editor.showTabs') });
442442
MenuRegistry.appendMenuItem(MenuId.EditorTitle, { command: { id: editorCommands.CLOSE_SAVED_EDITORS_COMMAND_ID, title: nls.localize('closeAllSaved', "Close Saved") }, group: '5_close', order: 20, when: ContextKeyExpr.has('config.workbench.editor.showTabs') });

src/vs/workbench/browser/parts/editor/editorCommands.ts

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
2323
import { IConfigurationService, ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
2424
import { CommandsRegistry, ICommandHandler } from 'vs/platform/commands/common/commands';
2525
import { MenuRegistry, MenuId } from 'vs/platform/actions/common/actions';
26+
import { INotificationService } from 'vs/platform/notification/common/notification';
2627

2728
export const CLOSE_SAVED_EDITORS_COMMAND_ID = 'workbench.action.closeUnmodifiedEditors';
2829
export const CLOSE_EDITORS_IN_GROUP_COMMAND_ID = 'workbench.action.closeEditorsInGroup';
@@ -36,7 +37,7 @@ export const MOVE_ACTIVE_EDITOR_COMMAND_ID = 'moveActiveEditor';
3637
export const LAYOUT_EDITOR_GROUPS_COMMAND_ID = 'layoutEditorGroups';
3738
export const KEEP_EDITOR_COMMAND_ID = 'workbench.action.keepEditor';
3839
export const SHOW_EDITORS_IN_GROUP = 'workbench.action.showEditorsInGroup';
39-
export const TOGGLE_DIFF_INLINE_MODE = 'toggle.diff.editorMode';
40+
export const TOGGLE_DIFF_SIDE_BY_SIDE = 'toggle.diff.renderSideBySide';
4041

4142
export const SPLIT_EDITOR_UP = 'workbench.action.splitEditorUp';
4243
export const SPLIT_EDITOR_DOWN = 'workbench.action.splitEditorDown';
@@ -247,22 +248,31 @@ function registerDiffEditorCommands(): void {
247248
}
248249
}
249250

251+
function toggleDiffSideBySide(accessor: ServicesAccessor): void {
252+
const configurationService = accessor.get(IConfigurationService);
253+
254+
const newValue = !configurationService.getValue<boolean>('diffEditor.renderSideBySide');
255+
configurationService.updateValue('diffEditor.renderSideBySide', newValue, ConfigurationTarget.USER);
256+
}
257+
250258
KeybindingsRegistry.registerCommandAndKeybindingRule({
251-
id: TOGGLE_DIFF_INLINE_MODE,
259+
id: TOGGLE_DIFF_SIDE_BY_SIDE,
252260
weight: KeybindingWeight.WorkbenchContrib,
253261
when: void 0,
254262
primary: void 0,
255-
handler: (accessor, resourceOrContext: URI | IEditorCommandsContext, context?: IEditorCommandsContext) => {
256-
const configurationService = accessor.get(IConfigurationService);
263+
handler: accessor => toggleDiffSideBySide(accessor)
264+
});
257265

258-
const newValue = !configurationService.getValue<boolean>('diffEditor.renderSideBySide');
259-
return configurationService.updateValue('diffEditor.renderSideBySide', newValue, ConfigurationTarget.USER);
260-
}
266+
// TODO@Ben remove me after a while
267+
CommandsRegistry.registerCommand('toggle.diff.editorMode', accessor => {
268+
toggleDiffSideBySide(accessor);
269+
270+
accessor.get(INotificationService).warn(nls.localize('diffCommandDeprecation', "Command 'toggle.diff.editorMode' has been deprecated. Please use '{0}' instead.", TOGGLE_DIFF_SIDE_BY_SIDE));
261271
});
262272

263273
MenuRegistry.appendMenuItem(MenuId.CommandPalette, {
264274
command: {
265-
id: TOGGLE_DIFF_INLINE_MODE,
275+
id: TOGGLE_DIFF_SIDE_BY_SIDE,
266276
title: {
267277
value: nls.localize('toggleInlineView', "Toggle Inline View"),
268278
original: 'Compare: Toggle Inline View'

0 commit comments

Comments
 (0)