mirror of
https://github.com/Microsoft/vscode
synced 2024-10-12 06:17:18 +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 marginBefore = whitespaceBefore ? (fontSize / 3) | 0 : 0;
|
||||||
const marginAfter = whitespaceAfter ? (fontSize / 3) | 0 : 0;
|
const marginAfter = whitespaceAfter ? (fontSize / 3) | 0 : 0;
|
||||||
|
|
||||||
|
const massagedText = fixSpace(text);
|
||||||
|
|
||||||
const before: IContentDecorationRenderOptions = {
|
const before: IContentDecorationRenderOptions = {
|
||||||
contentText: text,
|
contentText: massagedText,
|
||||||
backgroundColor: `${backgroundColor}`,
|
backgroundColor: `${backgroundColor}`,
|
||||||
color: `${fontColor}`,
|
color: `${fontColor}`,
|
||||||
margin: `0px ${marginAfter}px 0px ${marginBefore}px`,
|
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);
|
registerEditorContribution(InlayHintsController.ID, InlayHintsController);
|
||||||
|
|
||||||
CommandsRegistry.registerCommand('_executeInlayHintProvider', async (accessor, ...args: [URI, IRange]): Promise<InlayHint[]> => {
|
CommandsRegistry.registerCommand('_executeInlayHintProvider', async (accessor, ...args: [URI, IRange]): Promise<InlayHint[]> => {
|
||||||
|
|
Loading…
Reference in a new issue