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

fix #54444

上级 8018066b
......@@ -19,7 +19,7 @@ import { OutlineElement, OutlineGroup, OutlineModel, TreeElement } from 'vs/edit
import { ContextKeyExpr, IContextKey, IContextKeyService, RawContextKey } from 'vs/platform/contextkey/common/contextkey';
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
import { FileKind, IFileService } from 'vs/platform/files/common/files';
import { IConstructorSignature2, IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IConstructorSignature1, IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry';
import { attachBreadcrumbsStyler } from 'vs/platform/theme/common/styler';
import { IThemeService } from 'vs/platform/theme/common/themeService';
......@@ -263,9 +263,10 @@ export class BreadcrumbsControl {
return event.node;
},
render: (parent: HTMLElement) => {
let ctor: IConstructorSignature2<HTMLElement, BreadcrumbElement, BreadcrumbsPicker> = element instanceof FileElement ? BreadcrumbsFilePicker : BreadcrumbsOutlinePicker;
let res = this._instantiationService.createInstance(ctor, parent, element);
let ctor: IConstructorSignature1<HTMLElement, BreadcrumbsPicker> = element instanceof FileElement ? BreadcrumbsFilePicker : BreadcrumbsOutlinePicker;
let res = this._instantiationService.createInstance(ctor, parent);
res.layout({ width: Math.max(220, dom.getTotalWidth(event.node)), height: 330 });
res.setInput(element);
let listener = res.onDidPickElement(data => {
this._contextViewService.hideContextView();
this._widget.setFocused(undefined);
......
......@@ -40,7 +40,6 @@ export abstract class BreadcrumbsPicker {
constructor(
container: HTMLElement,
input: BreadcrumbElement,
@IInstantiationService protected readonly _instantiationService: IInstantiationService,
@IThemeService protected readonly _themeService: IThemeService,
) {
......@@ -64,17 +63,6 @@ export abstract class BreadcrumbsPicker {
}
}));
this._tree.setInput(this._getInput(input)).then(() => {
let selection = this._getInitialSelection(this._tree, input);
if (selection) {
this._tree.reveal(selection).then(() => {
this._tree.setSelection([selection], this._tree);
this._tree.setFocus(selection);
});
}
}, onUnexpectedError);
// this._input.focus();
this._tree.domFocus();
}
......@@ -85,6 +73,19 @@ export abstract class BreadcrumbsPicker {
this._focus.dispose();
}
setInput(input: any): void {
let actualInput = this._getInput(input);
this._tree.setInput(actualInput).then(() => {
let selection = this._getInitialSelection(this._tree, input);
if (selection) {
this._tree.reveal(selection).then(() => {
this._tree.setSelection([selection], this._tree);
this._tree.setFocus(selection);
});
}
}, onUnexpectedError);
}
layout(dim: dom.Dimension) {
this._domNode.style.width = `${dim.width}px`;
this._domNode.style.height = `${dim.height}px`;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册