Fixes space in #139023.

This commit is contained in:
Henning Dieterichs
2022-01-11 14:25:02 +01:00
parent 442521b399
commit fcc0e261da
2 changed files with 38 additions and 21 deletions
@@ -68,30 +68,48 @@ class InlineSegment {
}
}
function createInlineValueDecoration(lineNumber: number, contentText: string, column = Constants.MAX_SAFE_SMALL_INTEGER): IModelDeltaDecoration {
function createInlineValueDecoration(lineNumber: number, contentText: string, column = Constants.MAX_SAFE_SMALL_INTEGER): IModelDeltaDecoration[] {
// If decoratorText is too long, trim and add ellipses. This could happen for minified files with everything on a single line
if (contentText.length > MAX_INLINE_DECORATOR_LENGTH) {
contentText = contentText.substring(0, MAX_INLINE_DECORATOR_LENGTH) + '...';
}
return {
range: {
startLineNumber: lineNumber,
endLineNumber: lineNumber,
startColumn: column,
endColumn: column
},
options: {
description: 'debug-inline-value-decoration',
after: {
content: replaceWsWithNoBreakWs(contentText),
inlineClassName: 'debug-inline-value',
inlineClassNameAffectsLetterSpacing: true,
cursorStops: InjectedTextCursorStops.Left
return [
{
range: {
startLineNumber: lineNumber,
endLineNumber: lineNumber,
startColumn: column,
endColumn: column
},
showIfCollapsed: true
}
};
options: {
description: 'debug-inline-value-decoration-spacer',
after: {
content: strings.noBreakWhitespace,
cursorStops: InjectedTextCursorStops.None
},
showIfCollapsed: true,
}
},
{
range: {
startLineNumber: lineNumber,
endLineNumber: lineNumber,
startColumn: column,
endColumn: column
},
options: {
description: 'debug-inline-value-decoration',
after: {
content: replaceWsWithNoBreakWs(contentText),
inlineClassName: 'debug-inline-value',
inlineClassNameAffectsLetterSpacing: true,
cursorStops: InjectedTextCursorStops.None
},
showIfCollapsed: true,
}
},
];
}
function replaceWsWithNoBreakWs(str: string): string {
@@ -135,7 +153,7 @@ function createInlineValueDecorationsInsideRange(expressions: ReadonlyArray<IExp
const content = model.getLineContent(line);
return content.indexOf(first) - content.indexOf(second);
}).map(name => `${name} = ${nameValueMap.get(name)}`).join(', ');
decorations.push(createInlineValueDecoration(line, contentText));
decorations.push(...createInlineValueDecoration(line, contentText));
});
return decorations;
@@ -700,7 +718,7 @@ export class DebugEditorContribution implements IDebugEditorContribution {
if (segments.length > 0) {
segments = segments.sort((a, b) => a.column - b.column);
const text = segments.map(s => s.text).join(separator);
allDecorations.push(createInlineValueDecoration(line, text));
allDecorations.push(...createInlineValueDecoration(line, text));
}
});
@@ -118,6 +118,5 @@
.monaco-workbench .debug-inline-value {
background-color: var(--vscode-editor-inlineValuesBackground);
margin: 10px;
color: var(--vscode-editor-inlineValuesForeground);
}