Skip to content

Conversation

@r3m0t
Copy link
Contributor

@r3m0t r3m0t commented May 13, 2023

Fixes #170449

Setting:

    "editor.fontLigatures": "'liga', 'calt', 'cv16'", // *
"editor.fontFamily": "'Fira Code'",

Extension:

vscode.languages.registerInlayHintsProvider({pattern: "**"}, {
		provideInlayHints(document, range, token) {
			const ret:vscode.InlayHint[] = [];
			for (let i = range.start.line; i <= range.end.line; i++) {
				const lineText = document.lineAt(i).text;
				for (const j of lineText.matchAll(/&/g)) {
					ret.push({label: "&", position: new vscode.Position(i, j.index!)});
				}
				for (const j of lineText.matchAll(/==/g)) {
					ret.push({label: "=", position: new vscode.Position(i, j.index!)});
				}
				if (token.isCancellationRequested) throw new vscode.CancellationError();
			}
			return ret;
		},
	});

Expected result:

image

vs VS Code:

image

See https://www.w3.org/TR/2023/CRD-css-text-3-20230213/#boundary-shaping

@hediet hediet added this to the May 2023 milestone May 22, 2023
@hediet
Copy link
Member

hediet commented May 22, 2023

Thanks a lot!

@hediet hediet enabled auto-merge May 22, 2023 09:57
@hediet hediet merged commit 09f80f4 into microsoft:main May 22, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Jul 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ligatures are formed between inlay hints and code as well as between separate inlay hints

3 participants