Skip to content

Commit

Permalink
suggest: cleanup on hide #1923
Browse files Browse the repository at this point in the history
  • Loading branch information
joaomoreno committed Jan 25, 2016
1 parent 7c35e01 commit 8057d11
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/vs/editor/contrib/suggest/browser/suggestWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,9 @@ function isRoot(element: any): boolean {
class DataSource implements Tree.IDataSource {

public getId(tree: Tree.ITree, element: any): string {
if (element instanceof CompletionModel) {
if (!element) {
return 'empty';
} else if (isRoot(element)) {
return 'root';
} else if (element instanceof CompletionItem) {
return (<CompletionItem>element).id.toString();
Expand All @@ -185,7 +187,7 @@ class DataSource implements Tree.IDataSource {
}

public getChildren(tree: Tree.ITree, element: any): TPromise<any[]> {
if (element instanceof CompletionModel) {
if (isRoot(element)) {
return TPromise.as((<CompletionModel>element).items);
}

Expand Down Expand Up @@ -928,6 +930,7 @@ export class SuggestWidget implements EditorBrowser.IContentWidget, IDisposable
this._onDidVisibilityChange.fire(false);
removeClass(this.element, 'visible');
this.editor.layoutContentWidget(this);
this.tree.setInput(null);
}

public cancel(): void {
Expand Down

0 comments on commit 8057d11

Please sign in to comment.