-
-
Notifications
You must be signed in to change notification settings - Fork 863
Description
The <> characters are commonly used like brackets in languages with generics. Unfortunately, that leads to some places where their existing ligatures cause problems:
Issue 1: >:
When the >: characters appear together, but are meant to have different highlighting, the ligature breaks things and ends up looking very odd. For example, in this code:
pub trait Action<S>: Clone
where
S: State,
{
// ...
}The : should appear in red, and the < > should be in white/gray. However, the >: appear as one glyph and so they are both rendered in red:
You can see that also the > is pulled away from the S a little bit, making the spacing asymmetric (similar to the next issue).
Issue 2: >>>
When a generic type gets complicated, it's not uncommon to have multiple closing-angle-brackets in a row, like: >>>. However, because this >>> is a ligature, the spacing gets a little awkward as the three brackets are spaced away from the text beside them:
This does also happen with >>, but the spacing is much smaller and so it is not really noticeable without zooming in.
I don't have any examples on hand, but I suspect this is probably an issue with <<< as well.
Since these >>> and >: are valid ligatures, and they make sense to use for operators or similar, I don't think they should be removed or anything like that. I suspect, rather than trying to tweak these existing ligatures to work well in these edge-cases, simply having a feature flag / cvXX to disable them when working in generic-heavy languages like Rust would be a fairly decent approach. That way you don't need to try and account for all the bizarre ways these characters may be used.
Although, there are a lot of feature flags already... I feel bad asking for another one. 😅


