mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
Use ZWNJ to prevent VSCode from forming ligatures between hints and code
This commit is contained in:
parent
50801b7d6a
commit
c4d8cf1dad
1 changed files with 18 additions and 0 deletions
|
@ -100,6 +100,24 @@ export async function createClient(
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
async provideInlayHints(document, viewPort, token, next) {
|
||||||
|
const inlays = await next(document, viewPort, token);
|
||||||
|
if (!inlays) {
|
||||||
|
return inlays;
|
||||||
|
}
|
||||||
|
// U+200C is a zero-width non-joiner to prevent the editor from forming a ligature
|
||||||
|
// between code and hints
|
||||||
|
for (const inlay of inlays) {
|
||||||
|
if (typeof inlay.label === "string") {
|
||||||
|
inlay.label = `\u{200c}${inlay.label}\u{200c}`;
|
||||||
|
} else if (Array.isArray(inlay.label)) {
|
||||||
|
for (const it of inlay.label) {
|
||||||
|
it.value = `\u{200c}${it.value}\u{200c}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return inlays;
|
||||||
|
},
|
||||||
async handleDiagnostics(
|
async handleDiagnostics(
|
||||||
uri: vscode.Uri,
|
uri: vscode.Uri,
|
||||||
diagnostics: vscode.Diagnostic[],
|
diagnostics: vscode.Diagnostic[],
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue