mirror of
https://github.com/Microsoft/vscode
synced 2024-10-12 22:37:41 +00:00
Fixes microsoft/monaco-editor#2081: Dispatch Escape via keybinding service in tree
This commit is contained in:
parent
0aba673183
commit
30671276a3
|
@ -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',
|
||||
|
|
Loading…
Reference in a new issue