Skip to content
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

Negative arguments for C++ non-type template parameters interact badly with left-arrow ligatures #107

Closed
chiphogg opened this issue Jan 28, 2020 · 5 comments
Labels
enhancement New feature or request
Milestone

Comments

@chiphogg
Copy link

For example,

auto foo = Constant<-1>;

The <- renders as an arrow. It just looks wrong.

Never mind how realistic this example may or may not be. 🙂 I actually encounter non-type template parameters routinely in my codebase.

Perhaps the ligature could be disabled if the <- is followed by digits and/or a ., with a , or > afterwards? I don't have any idea how ligature disabling works, but I've noticed that it happens if, e.g., I keep typing multiple ###... or ///....

@philippnurullin
Copy link
Member

Hi @chiphogg . I'm looking for solution right now. How many digits you think can be in <-1>?
Please provide more examples.
We may find a solutions but OpenType is pretty "forward" language.

@philippnurullin philippnurullin added the enhancement New feature or request label Jul 15, 2020
@chiphogg
Copy link
Author

In my use cases, it's only ever been single-digit numbers. I'm sure that would cover the majority of use cases, although I see no reason it couldn't be more.

(If it helps motivate my request, the context is in strongly-typed unit systems, and the non-type template parameters refer to the exponents for fundamental dimensioned quantities. So, for example, a strongly-typed "acceleration" type would have something like time_dimension<-2> as a template parameter.)

@philippnurullin philippnurullin added this to the v2.3000 milestone Oct 16, 2020
philippnurullin added a commit that referenced this issue Jan 22, 2021
- Added exclusion in -> ligature to look reasonable in negative arguments for C++ <1-> #107
- /** brought back #202
- */ /* aligned to match *  #215
- Added multiline bracket characters ⎛ ⎞ ⎝ ⎠ ⎜ #290
- Fixed Powerline arrows height #395
@philippnurullin
Copy link
Member

Looks like a made exclusion in the wrong ligature. ))
Sorry, will correct it few days.

philippnurullin added a commit that referenced this issue Jan 25, 2021
- Added exclusion in `<-` ligature to look reasonable in negative arguments for C++ `<-1>` #107
- Removed `[||]` ligature to more consistence with `[|`  `|]` #353
- Added `ϖ` #369
- Added exclusion in `[<` `>]` to perform in `[<=5]` expression #388
- Fixed Powerline overlapping #395
@philippnurullin
Copy link
Member

Should be correct now.
Feel free to reopen otherwise.

@kawazoe
Copy link

kawazoe commented Sep 11, 2022

I came to report a similar issue in TypeScript generic types. While it isn't specifically about the <- ligature, it is still related to generic types/template syntax.

There are ligatures for >>> which can trigger in types like Promise<Map<string, Foo<number>>>. It only impact spacing, so maybe the font could include some special kerning rules for cases like >>>(, >>>[, >>>; and >>>\n which I believe are the most common odd looking ones; they all end up with a large amount of white-space on the left. The double arrow version (>>) seems to behave better in that regard.

image

However, I also tried the repro for this report and it doesn't appear to be fixed in the version shipped with WebStorm 2022.2.1. Could it be a regression?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants