Skip to content

Commit 035e55c

Browse files
authored
Adjust width for rename suggestions (microsoft#205689)
rename suggestions: adjust width so longer candidates don't overflow
1 parent 2110f10 commit 035e55c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -501,9 +501,11 @@ class CandidatesView {
501501

502502
this._listWidget.splice(0, 0, candidates);
503503

504-
this._listWidget.layout(height, this._pickListWidth(candidates));
504+
const width = Math.max(200, 4 /* padding */ + 16 /* sparkle icon */ + 5 /* margin-left */ + this._pickListWidth(candidates)); // TODO@ulugbekna: approximate calc - clean this up
505+
this._listWidget.layout(height, width);
505506

506507
this._listContainer.style.height = `${height}px`;
508+
this._listContainer.style.width = `${width}px`;
507509
}
508510

509511
public clearCandidates(): void {
@@ -577,7 +579,7 @@ class CandidatesView {
577579
}
578580

579581
private _pickListWidth(candidates: NewSymbolName[]): number {
580-
return Math.max(...candidates.map(c => c.newSymbolName.length)) * 7 /* approximate # of pixes taken by a single character */;
582+
return Math.ceil(Math.max(...candidates.map(c => c.newSymbolName.length)) * 7.2) /* approximate # of pixes taken by a single character */;
581583
}
582584

583585
}

0 commit comments

Comments
 (0)