diff options
-rw-r--r-- | src/vs/editor/contrib/suggest/suggestWidgetRenderer.ts | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/vs/editor/contrib/suggest/suggestWidgetRenderer.ts b/src/vs/editor/contrib/suggest/suggestWidgetRenderer.ts index a3763880de2..0eae1697985 100644 --- a/src/vs/editor/contrib/suggest/suggestWidgetRenderer.ts +++ b/src/vs/editor/contrib/suggest/suggestWidgetRenderer.ts @@ -209,13 +209,13 @@ export class ItemRenderer implements IListRenderer<CompletionItem, ISuggestionTe if (typeof completion.label === 'string') { data.parametersLabel.textContent = ''; data.qualifierLabel.textContent = ''; - data.detailsLabel.textContent = (completion.detail || '').replace(/\n.*$/m, ''); + data.detailsLabel.textContent = stripNewLines(completion.detail || ''); data.root.classList.add('string-label'); data.root.title = ''; } else { - data.parametersLabel.textContent = (completion.label.parameters || '').replace(/\n.*$/m, ''); - data.qualifierLabel.textContent = (completion.label.qualifier || '').replace(/\n.*$/m, ''); - data.detailsLabel.textContent = (completion.label.type || '').replace(/\n.*$/m, ''); + data.parametersLabel.textContent = stripNewLines(completion.label.parameters || ''); + data.qualifierLabel.textContent = stripNewLines(completion.label.qualifier || ''); + data.detailsLabel.textContent = stripNewLines(completion.label.type || ''); data.root.classList.remove('string-label'); data.root.title = `${element.textLabel}${completion.label.parameters ?? ''} ${completion.label.qualifier ?? ''} ${completion.label.type ?? ''}`; } @@ -250,3 +250,7 @@ export class ItemRenderer implements IListRenderer<CompletionItem, ISuggestionTe templateData.disposables.dispose(); } } + +function stripNewLines(str: string): string { + return str.replace(/\r\n|\r|\n/g, ''); +} |