mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-08-22 19:34:16 +00:00
Insert a ZWNJ before type hints
This commit is contained in:
parent
3e450cf89f
commit
010d123f23
1 changed files with 4 additions and 2 deletions
|
@ -44,10 +44,12 @@ const paramHints = createHintStyle("parameter");
|
||||||
const chainingHints = createHintStyle("chaining");
|
const chainingHints = createHintStyle("chaining");
|
||||||
|
|
||||||
function createHintStyle(hintKind: "type" | "parameter" | "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] = ({
|
const [pos, render] = ({
|
||||||
type: ["after", (label: string) => `: ${label}`],
|
type: ["after", (label: string) => `\u{200c}: ${label}`],
|
||||||
parameter: ["before", (label: string) => `${label}: `],
|
parameter: ["before", (label: string) => `${label}: `],
|
||||||
chaining: ["after", (label: string) => `: ${label}`],
|
chaining: ["after", (label: string) => `\u{200c}: ${label}`],
|
||||||
} as const)[hintKind];
|
} as const)[hintKind];
|
||||||
|
|
||||||
const fg = new vscode.ThemeColor(`rust_analyzer.inlayHints.foreground.${hintKind}Hints`);
|
const fg = new vscode.ThemeColor(`rust_analyzer.inlayHints.foreground.${hintKind}Hints`);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue