diff --git a/src/vs/base/browser/ui/list/listWidget.ts b/src/vs/base/browser/ui/list/listWidget.ts index 5a7442712b7..2be9583c94b 100644 --- a/src/vs/base/browser/ui/list/listWidget.ts +++ b/src/vs/base/browser/ui/list/listWidget.ts @@ -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 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); diff --git a/src/vs/editor/contrib/suggest/browser/suggestWidget.ts b/src/vs/editor/contrib/suggest/browser/suggestWidget.ts index e253820e4ca..81b94a47c0e 100644 --- a/src/vs/editor/contrib/suggest/browser/suggestWidget.ts +++ b/src/vs/editor/contrib/suggest/browser/suggestWidget.ts @@ -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; + 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.list.getContentHeight() - focusHeight) / 19; - // height += Math.min(suggestionCount, 11) * 19; - // } + 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);