Skip to content

Commit c4d8cf1

Browse files
committed
Use ZWNJ to prevent VSCode from forming ligatures between hints and code
1 parent 50801b7 commit c4d8cf1

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

editors/code/src/client.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,24 @@ export async function createClient(
100100
}
101101
},
102102
},
103+
async provideInlayHints(document, viewPort, token, next) {
104+
const inlays = await next(document, viewPort, token);
105+
if (!inlays) {
106+
return inlays;
107+
}
108+
// U+200C is a zero-width non-joiner to prevent the editor from forming a ligature
109+
// between code and hints
110+
for (const inlay of inlays) {
111+
if (typeof inlay.label === "string") {
112+
inlay.label = `\u{200c}${inlay.label}\u{200c}`;
113+
} else if (Array.isArray(inlay.label)) {
114+
for (const it of inlay.label) {
115+
it.value = `\u{200c}${it.value}\u{200c}`;
116+
}
117+
}
118+
}
119+
return inlays;
120+
},
103121
async handleDiagnostics(
104122
uri: vscode.Uri,
105123
diagnostics: vscode.Diagnostic[],

0 commit comments

Comments
 (0)