Fixes #128964 by replacing whitespaces/tab with no-break whitespace.

This commit is contained in:
Henning Dieterichs 2021-07-23 13:40:48 +02:00
parent b9c8788542
commit a72a41d207
No known key found for this signature in database
GPG key ID: 771381EFFDB9EC06

View file

@ -157,8 +157,10 @@ export class InlayHintsController implements IEditorContribution {
const marginBefore = whitespaceBefore ? (fontSize / 3) | 0 : 0;
const marginAfter = whitespaceAfter ? (fontSize / 3) | 0 : 0;
const massagedText = fixSpace(text);
const before: IContentDecorationRenderOptions = {
contentText: text,
contentText: massagedText,
backgroundColor: `${backgroundColor}`,
color: `${fontColor}`,
margin: `0px ${marginAfter}px 0px ${marginBefore}px`,
@ -207,6 +209,11 @@ export class InlayHintsController implements IEditorContribution {
}
}
function fixSpace(str: string): string {
const noBreakWhitespace = '\xa0';
return str.replace(/[ \t]/g, noBreakWhitespace);
}
registerEditorContribution(InlayHintsController.ID, InlayHintsController);
CommandsRegistry.registerCommand('_executeInlayHintProvider', async (accessor, ...args: [URI, IRange]): Promise<InlayHint[]> => {