Skip to content

Use ZWNJ to prevent VSCode from forming ligatures between hints and code #13886

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions editors/code/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
uri: vscode.Uri,
diagnostics: vscode.Diagnostic[],
Expand Down