From 88689bc3cf4e83a9002c5dbbe3f2a121bc650d4c Mon Sep 17 00:00:00 2001 From: isidor Date: Thu, 12 Jan 2017 15:45:23 +0100 Subject: [PATCH] Multiline object properties fixes #18364 --- .../parts/debug/electron-browser/debugViewer.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/parts/debug/electron-browser/debugViewer.ts b/src/vs/workbench/parts/debug/electron-browser/debugViewer.ts index 4ba2c467049..2e9a9b0534b 100644 --- a/src/vs/workbench/parts/debug/electron-browser/debugViewer.ts +++ b/src/vs/workbench/parts/debug/electron-browser/debugViewer.ts @@ -49,6 +49,11 @@ export interface IRenderValueOptions { showHover?: boolean; } +function replaceWhitespace(value: string): string { + const map = { '\n': '\\n', '\r': '\\r', '\t': '\\t' }; + return value.replace(/[\n\r\t]/g, char => map[char]); +} + export function renderExpressionValue(expressionOrValue: debug.IExpression | string, container: HTMLElement, options: IRenderValueOptions): void { let value = typeof expressionOrValue === 'string' ? expressionOrValue : expressionOrValue.value; @@ -77,8 +82,7 @@ export function renderExpressionValue(expressionOrValue: debug.IExpression | str value = value.substr(0, options.maxValueLength) + '...'; } if (value && !options.preserveWhitespace) { - const map = { '\n': '\\n', '\r': '\\r', '\t': '\\t' }; - container.textContent = value.replace(/[\n\r\t]/g, char => map[char]); + container.textContent = replaceWhitespace(value); } else { container.textContent = value; } @@ -89,7 +93,7 @@ export function renderExpressionValue(expressionOrValue: debug.IExpression | str export function renderVariable(tree: ITree, variable: Variable, data: IVariableTemplateData, showChanged: boolean): void { if (variable.available) { - data.name.textContent = variable.name; + data.name.textContent = replaceWhitespace(variable.name); data.name.title = variable.type ? variable.type : ''; } -- GitLab