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

Problem about the <- exclusion #403

Open
yvvt0379 opened this issue Jan 29, 2021 · 3 comments
Open

Problem about the <- exclusion #403

yvvt0379 opened this issue Jan 29, 2021 · 3 comments

Comments

@yvvt0379
Copy link

<-1> looks right, but <-12> still looks wrong.
Screenshot_20210129_174428

@auduchinok
Copy link
Member

auduchinok commented Jan 29, 2021

It may be difficult to find the right balance here.

In the following assignment examples I'd expect the <- ligature to be applied (though, I'd also expect a space after it in a properly formatted code):

a<-1
a<-123
a<-b

a<-b>2
a<-1>b

If adding more exclusions, the following cases should probably also be taken into account:

// <-identifier>
// <-identifier_with_undersores>
// <-identifier-2>

The current rules work as expected when text is split into tokens and each token is highlighted differently. The problem on the screenshot above is due to comment it not being split into parts in the same way as code. There's a chance that disabling ligature completely in such cases might make more harm than good in the actual code (i.e. not comments and string literals parts).

Update: at the same time the splitting text into tokens helps it work as expected even in the <-1> case, so more exclusions seems not that bad:
Screenshot 2021-01-29 at 13 02 04

philippnurullin added a commit that referenced this issue Apr 21, 2021
- Made triple equal ligature === more spacious #25
- Added 70 symbols from #47
- Tuned # #275
- Added =: ligature #305
- Added floor and ceiling mathematical characters #328
- Corrections in Θ θ ξ Σ ∑ #351
- Added Cyrillic Kazakh letters #391
- Added ligature ;;; #393
- The ligature <- have 3 digit exclusion #403
- Fixed regression with <-- ligature #417
- Fixed interpolation error in Italic #431
- Corrected placement of * in */ ligature in Regular master
- Tuned Ч ч
- Rounded corners in ⚠
@philippnurullin
Copy link
Member

Added an exclusion up the 3 digits.

@auduchinok I'm not getting the "identifeier" thing. What exact symbols can be used it that expression?

@auduchinok
Copy link
Member

auduchinok commented Apr 21, 2021

@philippnurullin It mostly was about comments, i.e. some random texts that are ignored by programming languages and that could be, for instance, a description of the code nearby or a piece of code that is kind of removed by placing it into a comment (done by adding // before commented text in many programming languages).

AFAIK IntelliJ applies ligatures to differently highlighted pieces of code, so a ligature should fit into a highlighted piece of code, and in the case of a comment the whole comment is usually highlighted as one big thing.

What I was trying to say is there could be legitimate cases where <- ligature could be desired and there are cases where - and some other text are used inside angle brackets, and there's probably no way to distinguish these cases in a comment (because a comment is just a random text in most cases). These exclusions likely won't help much with text in comments. I can write // <-1234> or // <-1e123> and it already might't work with 3 digits exclusion in a way I could expect it to.

The initial report is about using text in a comment, that's why I'm thinking about comments a lot here. If this wasn't in a comment, the text would likely be split in a way that <- ligature wouldn't be applied by the platform even without the exclusion.

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

No branches or pull requests

3 participants