Skip to content

Commit 7dd09a7

Browse files
bors[bot]lnicola
andauthored
Merge #6236
6236: Code: Insert a ZWNJ before `after` type hints r=matklad a=lnicola to prevent the editor from displaying a ligature there. Fixes #6235 Co-authored-by: Laurențiu Nicola <[email protected]>
2 parents ba6679d + 010d123 commit 7dd09a7

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)