提交 730e26c5 编写于 作者: J Johannes Rieken

reveal then select, box input & tree in their own containers to prevent screen cheese

上级 52bbfc1f
...@@ -309,25 +309,31 @@ export abstract class BreadcrumbsPicker { ...@@ -309,25 +309,31 @@ export abstract class BreadcrumbsPicker {
this._focus = dom.trackFocus(this._domNode); this._focus = dom.trackFocus(this._domNode);
this._focus.onDidBlur(_ => this._onDidPickElement.fire(undefined), undefined, this._disposables); this._focus.onDidBlur(_ => this._onDidPickElement.fire(undefined), undefined, this._disposables);
this._input = new InputBox(this._domNode, undefined, { placeholder: localize('placeholder', "Find") }); const inputContainer = document.createElement('div');
inputContainer.className = 'breadcrumbs-picker-input';
this._domNode.appendChild(inputContainer);
this._input = new InputBox(inputContainer, undefined, { placeholder: localize('placeholder', "Find") });
this._input.setEnabled(false); this._input.setEnabled(false);
this._disposables.push(attachListStyler(this._input, this._themeService)); this._disposables.push(attachListStyler(this._input, this._themeService));
let treeConifg = this._completeTreeConfiguration({ dataSource: undefined, renderer: undefined }); const treeContainer = document.createElement('div');
this._tree = this._instantiationService.createInstance(WorkbenchTree, this._domNode, treeConifg, {}); treeContainer.className = 'breadcrumbs-picker-tree';
this._domNode.appendChild(treeContainer);
const treeConifg = this._completeTreeConfiguration({ dataSource: undefined, renderer: undefined });
this._tree = this._instantiationService.createInstance(WorkbenchTree, treeContainer, treeConifg, {});
this._disposables.push(this._tree.onDidChangeSelection(e => { this._disposables.push(this._tree.onDidChangeSelection(e => {
if (e.payload !== this) { if (e.payload !== this) {
setTimeout(_ => this._onDidChangeSelection(e)); // need to debounce here because this disposes the tree and the tree doesn't like to be disposed on click setTimeout(_ => this._onDidChangeSelection(e)); // need to debounce here because this disposes the tree and the tree doesn't like to be disposed on click
} }
})); }));
this._tree.setInput(this._getInput(input)).then(_ => { this._tree.setInput(this._getInput(input)).then(async _ => {
let selection = this._getInitialSelection(this._tree, input); let selection = this._getInitialSelection(this._tree, input);
if (selection) { if (selection) {
await this._tree.reveal(selection);
this._tree.setSelection([selection], this); this._tree.setSelection([selection], this);
this._tree.setFocus(selection); this._tree.setFocus(selection);
this._tree.reveal(selection);
} }
// input - interact with tree // input - interact with tree
...@@ -361,7 +367,7 @@ export abstract class BreadcrumbsPicker { ...@@ -361,7 +367,7 @@ export abstract class BreadcrumbsPicker {
this._tree.refresh(element).then(undefined, onUnexpectedError); this._tree.refresh(element).then(undefined, onUnexpectedError);
} }
if (topElement) { if (topElement) {
this._tree.reveal(topElement); await this._tree.reveal(topElement);
this._tree.setFocus(topElement); this._tree.setFocus(topElement);
this._tree.setSelection([topElement], this); this._tree.setSelection([topElement], this);
} }
......
...@@ -28,10 +28,18 @@ ...@@ -28,10 +28,18 @@
.monaco-workbench .monaco-breadcrumbs-picker { .monaco-workbench .monaco-breadcrumbs-picker {
overflow: hidden; overflow: hidden;
display: flex;
flex-direction: column;
} }
.monaco-workbench .monaco-breadcrumbs-picker .monaco-inputbox { .monaco-workbench .monaco-breadcrumbs-picker .breadcrumbs-picker-input {
margin: 5px 9px; padding: 5px 9px;
position: relative;
box-sizing: border-box;
}
.monaco-workbench .monaco-breadcrumbs-picker .breadcrumbs-picker-tree {
height: 100%;
} }
.monaco-workbench .monaco-breadcrumbs-picker .monaco-highlighted-label .highlight{ .monaco-workbench .monaco-breadcrumbs-picker .monaco-highlighted-label .highlight{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册