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 <lnicola@dend.ro>
This commit is contained in:
bors[bot] 2020-10-15 10:50:26 +00:00 committed by GitHub
commit 7dd09a7b34
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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`);