Skip to content

Commit 010d123

Browse files
committed
Insert a ZWNJ before type hints
1 parent 3e450cf commit 010d123

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

editors/code/src/inlay_hints.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,12 @@ const paramHints = createHintStyle("parameter");
4444
const chainingHints = createHintStyle("chaining");
4545

4646
function createHintStyle(hintKind: "type" | "parameter" | "chaining") {
47+
// U+200C is a zero-width non-joiner to prevent the editor from forming a ligature
48+
// between code and type hints
4749
const [pos, render] = ({
48-
type: ["after", (label: string) => `: ${label}`],
50+
type: ["after", (label: string) => `\u{200c}: ${label}`],
4951
parameter: ["before", (label: string) => `${label}: `],
50-
chaining: ["after", (label: string) => `: ${label}`],
52+
chaining: ["after", (label: string) => `\u{200c}: ${label}`],
5153
} as const)[hintKind];
5254

5355
const fg = new vscode.ThemeColor(`rust_analyzer.inlayHints.foreground.${hintKind}Hints`);

0 commit comments

Comments
 (0)