githubnext / monaspace

An innovative superfamily of fonts for code
https://monaspace.githubnext.com
SIL Open Font License 1.1
13.14k stars 219 forks source link

Rust turbofish uses unexpected angle bracket/colon ligature #171

Closed ian-h-chamberlain closed 1 month ago

ian-h-chamberlain commented 7 months ago

Rust code may contain a "turbofish", which is written like so:

let v = Vec::<i32>::new();

Since there is a ligature for >:, this seems to take priority rather than the second ::. This can also have a side effect of making syntax highlighting look a bit weird if the > is a different token type than ::, like so:

Screenshot 2023-12-05 at 10 20 24

Both of these ligatures are part of calt so as far as I can tell there's no way to disable just >: with configuration.

hikionori commented 5 months ago

Maybe this can help you?

"editor.fontLigatures": "'ss01', 'ss02', 'ss03', 'ss04', 'ss05', 'ss06', 'ss07', 'ss08', 'dlig'",

This just turns off calt code ligature

ian-h-chamberlain commented 5 months ago

That would probably work, but also has the side effect of disabling all the other calt ligatures, which I would want in Rust, e.g. &&, //, ///, .., ?., ::, etc.

The tradeoff of having all those other ligatures is probably worth it vs this one corner case, but I think the optimal solution would just be to give the :: ligature precedence over >: (if that's possible), or define a new contextual alternate for >::, or something along those lines.

Another alternative would be to move >: and related ligatures into their own stylistic set (ss09 or something), but I'm not sure that would really match up with how the rest of the stylistic sets are structured or what they are meant to be used for.

hikionori commented 5 months ago

I honestly don't see a big problem with this (turning off calt) simply because // and other is not that different in my opinion.

ian-h-chamberlain commented 5 months ago

I honestly don't see a big problem with this (turning off calt) simply because // and other is not that different in my opinion.

Actually, I just realized that disabling calt also disables all texture healing, which to me seems like one of the main selling points of this font family! I suppose in VSCode you can limit the disabling of calt to "[rust]" in the configuration, but IMO it would be preferable to have proper turbofish support in the calt set of ligatures.

hikionori commented 5 months ago

Okay, yes I agree, I’m wrong. And in general, according to the development idea, they should have foreseen the turbofish syntax and how it should be displayed.

idan commented 1 month ago

Fixed in ca8015b27bdc6d8e1201b1ad722f4ae3c38970d0