Skip to content

Commit f1e08f5

Browse files
committed
crop suggest details length, and markdown value length so that UX doesn't freeze, fixes microsoft#100949
1 parent b0c81f4 commit f1e08f5

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

src/vs/base/browser/markdownRenderer.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,10 +207,13 @@ export function renderMarkdown(markdown: IMarkdownString, options: MarkdownRende
207207
allowedSchemes.push(Schemas.command);
208208
}
209209

210+
// values that are too long will freeze the UI
211+
let value = markdown.value ?? '';
212+
if (value.length > 100_000) {
213+
value = `${value.substr(0, 100_000)}…`;
214+
}
210215
const renderedMarkdown = marked.parse(
211-
markdown.supportThemeIcons
212-
? markdownEscapeEscapedCodicons(markdown.value || '')
213-
: (markdown.value || ''),
216+
markdown.supportThemeIcons ? markdownEscapeEscapedCodicons(value) : value,
214217
markedOptions
215218
);
216219

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ class SuggestionDetails {
380380

381381
// --- details
382382
if (detail) {
383-
this.type.innerText = detail;
383+
this.type.innerText = detail.length > 100_000 ? `${detail.substr(0, 100_000)}…` : detail;
384384
show(this.type);
385385
} else {
386386
this.type.innerText = '';

0 commit comments

Comments
 (0)