From 010d123f23e0b3766b0501a5ad9dbdb47fee7ada Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Nicola?= Date: Thu, 15 Oct 2020 10:29:30 +0300 Subject: Insert a ZWNJ before type hints --- editors/code/src/inlay_hints.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/editors/code/src/inlay_hints.ts b/editors/code/src/inlay_hints.ts index 30ade9b98..ed0db2924 100644 --- a/editors/code/src/inlay_hints.ts +++ b/editors/code/src/inlay_hints.ts @@ -44,10 +44,12 @@ const paramHints = createHintStyle("parameter"); const chainingHints = createHintStyle("chaining"); function createHintStyle(hintKind: "type" | "parameter" | "chaining") { + // U+200C is a zero-width non-joiner to prevent the editor from forming a ligature + // between code and type hints const [pos, render] = ({ - type: ["after", (label: string) => `: ${label}`], + type: ["after", (label: string) => `\u{200c}: ${label}`], parameter: ["before", (label: string) => `${label}: `], - chaining: ["after", (label: string) => `: ${label}`], + chaining: ["after", (label: string) => `\u{200c}: ${label}`], } as const)[hintKind]; const fg = new vscode.ThemeColor(`rust_analyzer.inlayHints.foreground.${hintKind}Hints`); -- cgit v1.2.3