提交 88689bc3 编写于 作者: I isidor

Multiline object properties

fixes #18364
上级 40f55cbc
......@@ -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 : '';
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册