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

Wrong color of ? operator in face of hints #6235

Closed
schungx opened this issue Oct 15, 2020 · 17 comments · Fixed by #6236
Closed

Wrong color of ? operator in face of hints #6235

schungx opened this issue Oct 15, 2020 · 17 comments · Fixed by #6236

Comments

@schungx
Copy link

schungx commented Oct 15, 2020

Not sure if anybody raised this before...

When chaining, and one of the parts ends with an ? operator, the hint's color bleeds into the ?, like the following:

image

Don't worry about the actual color (which is a faint grey) because I just set it this way.

In this example, the ? at the end of the chaining line should be colored regular, instead of as a hint.

@lnicola
Copy link
Member

lnicola commented Oct 15, 2020

Does it still happen if you disable ligatures? Or at least the ?: one, which doesn't make sense as Rust syntax.

@schungx
Copy link
Author

schungx commented Oct 15, 2020

You're right! The problem is font ligatures! I use Fira Code Retina.

Not sure whether I can selectively disable ?: in VS code, but true enough, disabling font ligatures solves the problem!

I suggest maybe putting a space in front of : in hints to avoid getting trapped with ligatures?

@schungx schungx closed this as completed Oct 15, 2020
@lnicola
Copy link
Member

lnicola commented Oct 15, 2020

I think you can, the Fira Code readme describes how each of them is called.

@lnicola
Copy link
Member

lnicola commented Oct 15, 2020

Sorry, I was thinking of https://github.com/tonsky/FiraCode/blob/master/extras/stylistic_sets.png, but there seems to be no alternative for that one.

@schungx
Copy link
Author

schungx commented Oct 15, 2020

Putting a space in front of the colon (or omit it completely if the colors are different enough from text) is a possible solution... I am not sure how many different ligatures end with :, so this may be worth considering.

@lnicola
Copy link
Member

lnicola commented Oct 15, 2020

I filed tonsky/FiraCode#1140 just in case, but I think a space or ZWNJ will work. Even if it's implemented, we should do that to support other fonts.

@lnicola
Copy link
Member

lnicola commented Oct 15, 2020

Strangely, I don't see the same effect (though that :: looks so derpy):

image

@schungx
Copy link
Author

schungx commented Oct 15, 2020

That's weird... perhaps you're using a font without ?: ligature? I believe ?: is not very common...

@lnicola
Copy link
Member

lnicola commented Oct 15, 2020

No, it's Fira Code 5.2. Maybe it was removed at some point? I couldn't find any reference to it in the changelog.

@schungx
Copy link
Author

schungx commented Oct 15, 2020

I have a really old version of Fira Code, version 1.204. Let me install the latest version to check...

@lnicola
Copy link
Member

lnicola commented Oct 15, 2020

It was removed in https://github.com/tonsky/FiraCode/blob/master/CHANGELOG.md#30-april-9-2020, I don't know why I couldn't find it before.

@schungx
Copy link
Author

schungx commented Oct 15, 2020

OK, confirmed. The latest version of Fira Code no longer has this problem! Good catch!!!

Unfortunately, JetBrains Mono still has it...

@lnicola
Copy link
Member

lnicola commented Oct 15, 2020

Can you test #6236?

@schungx
Copy link
Author

schungx commented Oct 15, 2020

Hhhmmm... don't know how to install a custom build of ra... I just load it from the the official extensions.

My suggestion is to add the JetBrains Mono font. The latest version should still have ?:.

Source Code Pro also doesn't have ?:, so right now the only recent version popular font that has it will be JetBrains Mono...

@lnicola
Copy link
Member

lnicola commented Oct 15, 2020

My suggestion is to add the JetBrains Mono font.

I find building the extension easier than installing fonts on Linux 😅.

Does this work?

image

@schungx
Copy link
Author

schungx commented Oct 15, 2020

I find building the extension easier than installing fonts on Linux 😅.

That's why you're DA MAN!

Does this work?

Your picture looks just fine!

@schungx
Copy link
Author

schungx commented Oct 15, 2020

Just for future reference, ?: also seems to conflict with TypeScript:

tonsky/FiraCode#970

bors bot added a commit that referenced this issue Oct 15, 2020
6236: Code: Insert a ZWNJ before `after` type hints r=matklad a=lnicola

to prevent the editor from displaying a ligature there. 

Fixes #6235

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
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

Successfully merging a pull request may close this issue.

2 participants