未验证 提交 30671276 编写于 作者: A Alex Dima

Fixes microsoft/monaco-editor#2081: Dispatch Escape via keybinding service in tree

上级 0aba6731
......@@ -33,6 +33,8 @@ import { FileReferences, OneReference, ReferencesModel } from '../referencesMode
import { FuzzyScore } from 'vs/base/common/filters';
import { SplitView, Sizing } from 'vs/base/browser/ui/splitview/splitview';
import { IUndoRedoService } from 'vs/platform/undoRedo/common/undoRedo';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { KeyCode } from 'vs/base/common/keyCodes';
class DecorationsManager implements IDisposable {
......@@ -219,6 +221,7 @@ export class ReferenceWidget extends peekView.PeekViewWidget {
@peekView.IPeekViewService private readonly _peekViewService: peekView.IPeekViewService,
@ILabelService private readonly _uriLabel: ILabelService,
@IUndoRedoService private readonly _undoRedoService: IUndoRedoService,
@IKeybindingService private readonly _keybindingService: IKeybindingService,
) {
super(editor, { showFrame: false, showArrow: true, isResizeable: true, isAccessible: true }, _instantiationService);
......@@ -322,6 +325,15 @@ export class ReferenceWidget extends peekView.PeekViewWidget {
listBackground: peekView.peekViewResultsBackground
}
};
if (this._defaultTreeKeyboardSupport) {
// the tree will consume `Escape` and prevent the widget from closing
this._callOnDispose.add(dom.addStandardDisposableListener(this._treeContainer, 'keydown', (e) => {
if (e.equals(KeyCode.Escape)) {
this._keybindingService.dispatchEvent(e, e.target);
e.stopPropagation();
}
}, true));
}
this._tree = this._instantiationService.createInstance(
ReferencesTree,
'ReferencesWidget',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册