提交 63b3bb26 编写于 作者: J Joao Moreno

suggest: dynamic height

上级 73ee1f80
......@@ -77,6 +77,10 @@ class TraitController {
return result;
}
get(): number[] {
return this.indexes;
}
add(index: number): void {
if (this.contains(index)) {
return;
......@@ -145,6 +149,10 @@ export class List<T> implements IDisposable {
indexes.forEach(i => this.view.splice(i, 1, this.view.element(i)));
}
getFocus(): T[] {
return this.focus.get().map(i => this.view.element(i));
}
reveal(index: number, relativeTop?: number): void {
const scrollTop = this.view.getScrollTop();
const elementTop = this.view.elementTop(index);
......
......@@ -986,21 +986,21 @@ export class SuggestWidget implements EditorBrowser.IContentWidget, IDisposable
private updateWidgetHeight(): number {
let height = 0;
// if (this.state === State.Empty || this.state === State.Loading) {
// height = 19;
// } else if (this.state === State.Details) {
// height = 12 * 19;
// } else {
// const focus = this.list.getFocus();
// const focusHeight = focus ? this.renderer.getHeight(this.list, focus) : 19;
// height += focusHeight;
// const suggestionCount = (this.list.getContentHeight() - focusHeight) / 19;
// height += Math.min(suggestionCount, 11) * 19;
// }
if (this.state === State.Empty || this.state === State.Loading) {
height = 19;
} else if (this.state === State.Details) {
height = 12 * 19;
} else {
// const focus = this.list.getFocus()[0];
// const focusHeight = 19//focus ? this.renderer.getHeight(this.list, focus) : 19;
// height += focusHeight;
const suggestionCount = this.completionModel.items.length //(this.list.getContentHeight() - focusHeight) / 19;
height += Math.min(suggestionCount, 11) * 19;
}
// TODO
height = 12 * 19;
// height = 12 * 19;
this.element.style.height = height + 'px';
this.list.layout(height);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册