mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 13:00:58 +00:00
Merge pull request #129237 from microsoft/hediet/no-break-ws-for-inlay-text
Replaces whitespaces/tab with no-break whitespace for inlay hints.
This commit is contained in:
commit
f93aba91e6
|
@ -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[]> => {
|
||||
|
|
Loading…
Reference in a new issue