Skip to content

Commit 155fcfa

Browse files
committed
suggest: fix handling around long lines
See: microsoft#90552 (comment) `overflow: hidden` should have been `overflow: auto`. Auto displays a scrollbar which, depending on the platform, can make the items too high. Also fixes names being cut off (see the loooong) cutoff in the linked issue. `flex-shrink:0` is on the label, with a max-width of 100%. But on the left there was the 18px icon, so the right side of the label was 18px off the end and not visible. Fix it by moving the icon outside of the `.left` side. We could alternately `calc(100% - 18px)`, but since the icon was not a hardcoded size in CSS I didn't want to implicitly depend on that.
1 parent 23850c7 commit 155fcfa

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

src/vs/editor/contrib/suggest/media/suggest.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@
176176
}
177177

178178
.monaco-editor .suggest-widget .monaco-list .monaco-list-row > .contents > .main > .left > .signature-label {
179-
overflow: auto;
179+
overflow: hidden;
180180
text-overflow: ellipsis;
181181
}
182182

@@ -228,6 +228,7 @@
228228

229229
.monaco-editor .suggest-widget .monaco-list .monaco-list-row > .contents > .main > .left {
230230
flex-shrink: 1;
231+
flex-grow: 1;
231232
overflow: hidden;
232233
}
233234
.monaco-editor .suggest-widget .monaco-list .monaco-list-row > .contents > .main > .left > .monaco-icon-label {

src/vs/editor/contrib/suggest/suggestWidget.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,10 @@ class ItemRenderer implements IListRenderer<CompletionItem, ISuggestionTemplateD
144144
const text = append(container, $('.contents'));
145145
const main = append(text, $('.main'));
146146

147+
data.iconContainer = append(main, $('.icon-label.codicon'));
147148
data.left = append(main, $('span.left'));
148149
data.right = append(main, $('span.right'));
149150

150-
data.iconContainer = append(data.left, $('.icon-label.codicon'));
151-
152151
data.iconLabel = new IconLabel(data.left, { supportHighlights: true, supportCodicons: true });
153152
data.disposables.add(data.iconLabel);
154153

0 commit comments

Comments
 (0)