diff --git a/src/vs/workbench/browser/parts/editor/editor.contribution.ts b/src/vs/workbench/browser/parts/editor/editor.contribution.ts index 14a3e1e0d6abc928fae6d5730337edb479a53574..3bfeb6a7f194fe5aa9cb319e2aca886d6ecf84f5 100644 --- a/src/vs/workbench/browser/parts/editor/editor.contribution.ts +++ b/src/vs/workbench/browser/parts/editor/editor.contribution.ts @@ -17,9 +17,10 @@ import {UntitledEditorInput} from 'vs/workbench/common/editor/untitledEditorInpu import {ResourceEditorInput} from 'vs/workbench/common/editor/resourceEditorInput'; import {IInstantiationService, ServicesAccessor} from 'vs/platform/instantiation/common/instantiation'; import {KeybindingsRegistry} from 'vs/platform/keybinding/common/keybindingsRegistry'; -import {KbExpr, IKeybindings} from 'vs/platform/keybinding/common/keybindingService'; +import {KbExpr, IKeybindings, IKeybindingService} from 'vs/platform/keybinding/common/keybindingService'; import {TextDiffEditor} from 'vs/workbench/browser/parts/editor/textDiffEditor'; import {IWorkbenchEditorService} from 'vs/workbench/services/editor/common/editorService'; +import {IMessageService, Severity, CloseAction} from 'vs/platform/message/common/message'; import {BinaryResourceDiffEditor} from 'vs/workbench/browser/parts/editor/binaryDiffEditor'; import {IEditorGroupService} from 'vs/workbench/services/group/common/groupService'; import {IConfigurationRegistry, Extensions as ConfigurationExtensions} from 'vs/platform/configuration/common/configurationRegistry'; @@ -402,4 +403,52 @@ configurationRegistry.registerConfiguration({ 'description': nls.localize('editorOpenPositioning', "Controls where editors open. Select 'left' or 'right' to open editors to the left or right of the current active one. Select 'first' or 'last' to open editors independently from the currently active one.") } } +}); + +// TODO@Ben remove me next version + +const mapDeprecatedCommands = { + 'workbench.action.focusFirstEditor': 'workbench.action.focusFirstEditorGroup', + 'workbench.action.focusSecondEditor': 'workbench.action.focusSecondEditorGroup', + 'workbench.action.focusThirdEditor': 'workbench.action.focusThirdEditorGroup', + 'workbench.action.focusLeftEditor': 'workbench.action.focusPreviousGroup', + 'workbench.action.focusRightEditor': 'workbench.action.focusNextGroup', + 'workbench.action.moveActiveEditorLeft': 'workbench.action.moveActiveEditorGroupLeft', + 'workbench.action.moveActiveEditorRight': 'workbench.action.moveActiveEditorGroupRight', + 'workbench.action.openPreviousEditor': 'workbench.action.openPreviousEditorFromHistory', + 'workbench.files.action.addToWorkingFiles': 'workbench.action.keepEditor', + 'workbench.files.action.closeAllFiles': 'workbench.action.closeAllEditors', + 'workbench.files.action.closeFile': 'workbench.action.closeActiveEditor', + 'workbench.files.action.closeOtherFiles': 'workbench.action.closeOtherEditors', + 'workbench.files.action.focusWorkingFiles': 'workbench.files.action.focusOpenEditorsView', + 'workbench.files.action.openNextWorkingFile': 'workbench.action.nextEditor', + 'workbench.files.action.openPreviousWorkingFile': 'workbench.action.previousEditor', + 'workbench.files.action.reopenClosedFile': 'workbench.action.reopenClosedEditor', + 'workbench.files.action.workingFilesPicker': 'workbench.action.showAllEditors', + 'workbench.action.cycleEditor': 'workbench.action.navigateEditorGroups' +}; + +Object.keys(mapDeprecatedCommands).forEach(deprecatedCommandId => { + const newCommandId = mapDeprecatedCommands[deprecatedCommandId]; + + KeybindingsRegistry.registerCommandDesc({ + id: deprecatedCommandId, + weight: KeybindingsRegistry.WEIGHT.workbenchContrib(0), + handler(accessor: ServicesAccessor) { + const messageService = accessor.get(IMessageService); + const keybindingService = accessor.get(IKeybindingService); + + messageService.show(Severity.Warning, { + message: nls.localize('commandDeprecated', "Command **{0}** is deprecated. Please use **{1}** instead", deprecatedCommandId, newCommandId), + actions: [ + CloseAction, + new Action('openKeybindings', nls.localize('openKeybindings', "Configure Keyboard Shortcuts"), null, true, () => { + return keybindingService.executeCommand('workbench.action.openGlobalKeybindings'); + }) + ] + }); + }, + when: undefined, + primary: undefined + }); }); \ No newline at end of file