Skip to content

syntax highlighters implementation for enhanced enums #47858

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

Closed
3 tasks done
Tracked by #47849
devoncarew opened this issue Dec 6, 2021 · 5 comments
Closed
3 tasks done
Tracked by #47849

syntax highlighters implementation for enhanced enums #47858

devoncarew opened this issue Dec 6, 2021 · 5 comments
Labels
area-tools A meta category for issues that should be addressed by tooling (prefer more concrete areas).

Comments

@devoncarew
Copy link
Member

devoncarew commented Dec 6, 2021

This is the syntax highlighters implementation for enhanced enums.

See #47849 for the main tracking issue.

@devoncarew devoncarew added the area-tools A meta category for issues that should be addressed by tooling (prefer more concrete areas). label Dec 6, 2021
@itsjustkevin
Copy link
Contributor

@devoncarew who should we contact to confirm the status of this issue?

@devoncarew
Copy link
Member Author

@DanTup, @srawlins, and @domesticmouse, respectively :)

@srawlins
Copy link
Member

srawlins commented May 5, 2022

For highlight.js, enhanced-enums seems to work out of the box.

@domesticmouse
Copy link
Member

domesticmouse commented May 9, 2022

Plugging the following into DartPad syntax highlights corrrectly:

enum Ordering with EnumIndexOrdering<Ordering> {
  zero,
  few,
  many;
}

mixin EnumIndexOrdering<T extends Enum> on Enum implements Comparable<T> {
  @override
  int compareTo(T other) => index - other.index;
}

void main() {
  var lst = [Ordering.many, Ordering.zero, Ordering.few]..sort();
  print(lst);
}

@DanTup
Copy link
Collaborator

DanTup commented May 9, 2022

The example above looks good to me in both the Textmate grammar and LSP too (the difference in white/blue is expected because the textmate grammar leaves them uncoloured but semantic tokens applies tokens).

Textmate grammar:

Screenshot 2022-05-09 at 10 02 51

LSP Semantic Tokens:

Screenshot 2022-05-09 at 10 03 03

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-tools A meta category for issues that should be addressed by tooling (prefer more concrete areas).
Projects
None yet
Development

No branches or pull requests

5 participants