-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
(Dart) Support Dart's new Null Safety type system #2550
Comments
Please add a usage of Never to your sample. A PR would be welcome. Tagging this as beginner friendly. |
Should the long list of built-in types just be duplicated to include, e.g. |
Duplication is probably best, but you can do it dynamically with JS... break out the types (or do all the Built-Ins count?) split them, then build a second set with |
You'll need to add |
Does this apply to user types as well? Is so might want to think about making it a mode instead that matches all |
Done.
It shouldn't; most Dart code is auto-formatted so that a ternary
It does, but I think it would be more confusing to match Although... it is exceedingly common practice to only name types with a leading capital letter (and optional |
Not sure what you mean? If the pattern was Although you have to be careful because modes eat content while keywords do not (keywords can match inside mode begin/end text, other modes cannot). That might not matter for Dart though. It seems to have a very simple grammar. |
@srawlins Any interest in taking a pass at the second part of this? |
Sorry, I dropped the thread here. I was getting at the idea that today we don't have any special mode for "types" that would include user types. For example: int v1;
UserType v2;
I think this is a fine. If user types should be highlighted separately from, say, functions and variables (e.g. display I can mail a PR adding |
Describe the issue
Dart's new Null Safety language feature introduces some new keywords and a new way to specify types:
late
andrequired
are new keywordsNever
is a new type found indart:core
(almost) all types can be suffixed with a
?
to indicate a nullable type. For example, in:f
is a function which accepts a non-nullint
parameter, andg
accepts a nullableint
parameter.Which language seems to have the issue?
Dart.
Are you using
highlight
orhighlightAuto
?Either.
Sample Code to Reproduce
Expected behavior
late
andrequired
should be highlighted as keywords.int?
should highlight the same asint
.Never
should be highlighted like the other built-in types.Additional context
The text was updated successfully, but these errors were encountered: