mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-15 21:01:05 +01:00
Relayout the suggestWidget when its height changes Fixes #45408
This commit is contained in:
@@ -370,6 +370,7 @@ export class SuggestWidget implements IContentWidget, IDelegate<ICompletionItem>
|
||||
private listElement: HTMLElement;
|
||||
private details: SuggestionDetails;
|
||||
private list: List<ICompletionItem>;
|
||||
private listHeight: number;
|
||||
|
||||
private suggestWidgetVisible: IContextKey<boolean>;
|
||||
private suggestWidgetMultipleSuggestions: IContextKey<boolean>;
|
||||
@@ -658,10 +659,6 @@ export class SuggestWidget implements IContentWidget, IDelegate<ICompletionItem>
|
||||
this._ariaAlert(this.details.getAriaLabel());
|
||||
break;
|
||||
}
|
||||
|
||||
if (stateChanged && this.state !== State.Hidden) {
|
||||
this.editor.layoutContentWidget(this);
|
||||
}
|
||||
}
|
||||
|
||||
showTriggered(auto: boolean) {
|
||||
@@ -918,7 +915,12 @@ export class SuggestWidget implements IContentWidget, IDelegate<ICompletionItem>
|
||||
}
|
||||
|
||||
private show(): void {
|
||||
this.updateListHeight();
|
||||
const newHeight = this.updateListHeight();
|
||||
if (newHeight !== this.listHeight) {
|
||||
this.editor.layoutContentWidget(this);
|
||||
this.listHeight = newHeight;
|
||||
}
|
||||
|
||||
this.suggestWidgetVisible.set(true);
|
||||
|
||||
this.showTimeout = TPromise.timeout(100).then(() => {
|
||||
@@ -958,7 +960,7 @@ export class SuggestWidget implements IContentWidget, IDelegate<ICompletionItem>
|
||||
return SuggestWidget.ID;
|
||||
}
|
||||
|
||||
private updateListHeight(): void {
|
||||
private updateListHeight(): number {
|
||||
let height = 0;
|
||||
|
||||
if (this.state === State.Empty || this.state === State.Loading) {
|
||||
@@ -971,6 +973,7 @@ export class SuggestWidget implements IContentWidget, IDelegate<ICompletionItem>
|
||||
this.element.style.lineHeight = `${this.unfocusedHeight}px`;
|
||||
this.listElement.style.height = `${height}px`;
|
||||
this.list.layout(height);
|
||||
return height;
|
||||
}
|
||||
|
||||
private adjustDocsPosition() {
|
||||
|
||||
Reference in New Issue
Block a user