diff --git a/src/vs/editor/browser/services/codeEditorServiceImpl.ts b/src/vs/editor/browser/services/codeEditorServiceImpl.ts index 44fca7b0f5cdfd985171d1f654e5198af1c31bd9..3731504b21264a388f6297212bf67588d7d6b57f 100644 --- a/src/vs/editor/browser/services/codeEditorServiceImpl.ts +++ b/src/vs/editor/browser/services/codeEditorServiceImpl.ts @@ -305,12 +305,14 @@ class DecorationRenderHelper { if (typeof opts !== 'undefined') { DecorationRenderHelper.collectBorderSettingsCSSText(opts, cssTextArr); if (typeof opts.contentIconPath === 'string') { - cssTextArr.push(strings.format(this._CSS_MAP.contentIconPath, URI.file(opts.contentIconPath).toString())); + cssTextArr.push(strings.format(this._CSS_MAP.contentIconPath, URI.file(opts.contentIconPath).toString().replace(/'/g, '%27'))); } else if (opts.contentIconPath instanceof URI) { cssTextArr.push(strings.format(this._CSS_MAP.contentIconPath, opts.contentIconPath.toString(true).replace(/'/g, '%27'))); } - if (typeof opts.contentText !== 'undefined') { - const escaped = opts.contentText.replace(/'/g, '\\\''); + if (typeof opts.contentText === 'string') { + const truncated = opts.contentText.match(/^.*$/m)[0]; // only take first line + const escaped = truncated.replace(/'\\/g, '\\$&'); + cssTextArr.push(strings.format(this._CSS_MAP.contentText, escaped)); } DecorationRenderHelper.collectCSSText(opts, ['textDecoration', 'color', 'backgroundColor', 'margin'], cssTextArr);