Skip to content

Commit 47becdc

Browse files
committed
rename suggestions: add dispose() to CandidatesView
1 parent c28d166 commit 47becdc

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/vs/editor/contrib/rename/browser/renameInputField.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,15 @@ export class RenameInputField implements IContentWidget {
107107
this._input.className = 'rename-input';
108108
this._input.type = 'text';
109109
this._input.setAttribute('aria-label', localize('renameAriaLabel', "Rename input. Type new name and press Enter to commit."));
110-
// TODO@ulugbekna: is using addDisposableListener's right way to do it?
111110
this._disposables.add(addDisposableListener(this._input, 'focus', () => { this._focusedContextKey.set(true); }));
112111
this._disposables.add(addDisposableListener(this._input, 'blur', () => { this._focusedContextKey.reset(); }));
113112
this._domNode.appendChild(this._input);
114113

115-
this._candidatesView = new CandidatesView(this._domNode, {
116-
fontInfo: this._editor.getOption(EditorOption.fontInfo),
117-
onSelectionChange: () => this.acceptInput(false) // we don't allow preview with mouse click for now
118-
});
114+
this._candidatesView = this._disposables.add(
115+
new CandidatesView(this._domNode, {
116+
fontInfo: this._editor.getOption(EditorOption.fontInfo),
117+
onSelectionChange: () => this.acceptInput(false) // we don't allow preview with mouse click for now
118+
}));
119119

120120
this._label = document.createElement('div');
121121
this._label.className = 'rename-label';
@@ -562,6 +562,10 @@ export class CandidatesView {
562562
}
563563
return focusedIx > 0;
564564
}
565+
566+
dispose() {
567+
this._listWidget.dispose();
568+
}
565569
}
566570

567571
export class CandidateView { // TODO@ulugbekna: remove export

0 commit comments

Comments
 (0)