提交 c7bc47ac 编写于 作者: J Johannes Rieken

add new config option 'editor.dismissPeekOnEsc' to control ESC when peek shows, #5120

上级 cb9b1852
......@@ -944,6 +944,11 @@ let editorConfiguration:IConfigurationNode = {
'default': DefaultConfig.editor.trimAutoWhitespace,
'description': nls.localize('trimAutoWhitespace', "Remove trailing auto inserted whitespace")
},
'editor.dismissPeekOnEsc' : {
'type': 'boolean',
'default': true,
'description': nls.localize('dismissPeekOnEsc', "Close peek editor when pressing ESC")
},
'diffEditor.renderSideBySide' : {
'type': 'boolean',
'default': true,
......
......@@ -14,7 +14,7 @@ import URI from 'vs/base/common/uri';
import {TPromise} from 'vs/base/common/winjs.base';
import {IEditorService} from 'vs/platform/editor/common/editor';
import {IInstantiationService, optional} from 'vs/platform/instantiation/common/instantiation';
import {ICommandHandler, IKeybindingContextKey, IKeybindingService} from 'vs/platform/keybinding/common/keybindingService';
import {ICommandHandler, IKeybindingContextKey, IKeybindingService, KbExpr} from 'vs/platform/keybinding/common/keybindingService';
import {KeybindingsRegistry} from 'vs/platform/keybinding/common/keybindingsRegistry';
import {IMessageService} from 'vs/platform/message/common/message';
import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
......@@ -390,17 +390,29 @@ KeybindingsRegistry.registerCommandDesc({
]
}
});
CommonEditorRegistry.registerEditorCommand('closeReferenceSearch', CommonEditorRegistry.commandWeight(50), { primary: KeyCode.Escape, secondary: [KeyMod.Shift | KeyCode.Escape] }, false, CONTEXT_REFERENCE_SEARCH_VISIBLE, (accessor, editor, args) => {
function closeActiveReferenceSearch(accessor, args) {
var outerEditor = getOuterEditor(accessor, args);
if (outerEditor) {
var controller = FindReferencesController.getController(outerEditor);
controller.closeReferenceSearch();
}
}
KeybindingsRegistry.registerCommandDesc({
id: 'closeReferenceSearch',
weight: CommonEditorRegistry.commandWeight(50),
primary: KeyCode.Escape,
secondary: [KeyMod.Shift | KeyCode.Escape],
when: KbExpr.and(KbExpr.has(CONTEXT_REFERENCE_SEARCH_VISIBLE), KbExpr.has('config.editor.dismissPeekOnEsc')),
handler: closeActiveReferenceSearch
});
CommonEditorRegistry.registerEditorCommand('closeReferenceSearchEditor', CommonEditorRegistry.commandWeight(-101), { primary: KeyCode.Escape, secondary: [KeyMod.Shift | KeyCode.Escape] }, false, ReferenceWidget.INNER_EDITOR_CONTEXT_KEY, (accessor, editor, args) => {
var outerEditor = getOuterEditor(accessor, args);
if (outerEditor) {
var controller = FindReferencesController.getController(outerEditor);
controller.closeReferenceSearch();
}
KeybindingsRegistry.registerCommandDesc({
id: 'closeReferenceSearchEditor',
weight: CommonEditorRegistry.commandWeight(-101),
primary: KeyCode.Escape,
secondary: [KeyMod.Shift | KeyCode.Escape],
when: KbExpr.and(KbExpr.has(ReferenceWidget.INNER_EDITOR_CONTEXT_KEY), KbExpr.has('config.editor.dismissPeekOnEsc')),
handler: closeActiveReferenceSearch
});
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册