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

Left arrow ligature in JavaScript + Flow #113

Open
SergioMorchon opened this issue Sep 24, 2019 · 4 comments
Open

Left arrow ligature in JavaScript + Flow #113

SergioMorchon opened this issue Sep 24, 2019 · 4 comments

Comments

@SergioMorchon
Copy link

@SergioMorchon SergioMorchon commented Sep 24, 2019

Environment

Cascadia Code version number: 1909.16
Application (with version) used to display text: Visual Studio Code 1.38.1
OS platform and version: Windows 10 Pro, 18362
Screen resolution (i.e. 220dpi): 1920x1080 @ 100%

Any other software? No

Steps to reproduce

  1. Open a JavaSript file that will be used with Flow (https://flow.org/).
  2. Open the following flow file: react-redux.
  3. You'll see declare type MapStateToProps<-S, -OP, +SP> =

Expected behavior

Don't apply a ligature in that case. It should keep as <-, because < is used to declare a generic, and - for write-only (see https://flow.org/en/docs/types/interfaces/#interface-property-variance-read-only-and-write-only-).

Actual behavior

That <-S is changed by a left arrow.

@ExE-Boss
Copy link

@ExE-Boss ExE-Boss commented Sep 24, 2019

Same with TypeScript (and other programming languages with generics):

let foo: Bar<-3>;
@aaronbell
Copy link
Collaborator

@aaronbell aaronbell commented Sep 24, 2019

It sounds like this is not something that can be special cased out in the font code (as in, ignore ligature when X occurs). That said, I can provide a stylistic set that turns off that specific ligature generally that would need to be accessible via font settings.

@ExE-Boss
Copy link

@ExE-Boss ExE-Boss commented Sep 24, 2019

Another option would be to improve the TextMate language grammar so that, - followed by a number has a different TextMate scope from the enclosing generics. Same with Flow’s read‑only and write‑only modifiers (+ and -).

This will fix it in VS Code, but not on GitHub:
Cascadia Code – TypeScript – Broken generics with negative number

@bterlson
Copy link
Member

@bterlson bterlson commented Sep 25, 2019

FWIW, I think flow is uniquely impacted by this given its variance sigils for generic parameters. TypeScript is impacted, but I suspect only in very niche cases where users are passing a negative number literal type. I think C# generic syntax doesn't allow <-.

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

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.