Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 59 additions & 7 deletions packages/devtools_app/assets/dart_syntax.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Dart",
"version": "1.4.1",
"version": "1.5.0",
"fileTypes": [
"dart"
],
Expand Down Expand Up @@ -60,6 +60,12 @@
{
"include": "#constants-and-special-vars"
},
{
"include": "#class-identifier-with-optional-factory-method"
},
{
"include": "#function-identifier"
},
{
"include": "#operators"
},
Expand Down Expand Up @@ -227,14 +233,50 @@
{
"name": "constant.numeric.dart",
"match": "(?<!\\$)\\b((0(x|X)[0-9a-fA-F][0-9a-fA-F_]*)|(([0-9][0-9_]*\\.?[0-9_]*)|(\\.[0-9][0-9_]*))((e|E)(\\+|-)?[0-9][0-9_]*)?)\\b(?!\\$)"
}
]
},
"class-identifier-with-optional-factory-method": {
"patterns": [
{
"match": "(?<!\\$)\\b(bool|num|int|double|dynamic)\\b(?!\\$)\\s*(factory\\b)?",
"captures": {
"1": {
"name": "support.class.dart"
},
"2": {
"name": "entity.name.function.dart"
}
}
},
{
"include": "#class-identifier"
"match": "(?<!\\$)\\b(void)\\b(?!\\$)\\s*(factory\\b)?",
"captures": {
"1": {
"name": "storage.type.primitive.dart"
},
"2": {
"name": "entity.name.function.dart"
}
}
},
{
"include": "#function-identifier"
"begin": "(?<![a-zA-Z0-9_$])([_$]*[A-Z][a-zA-Z0-9_$]*)\\b\\s*(factory\\b)?",
"end": "(?!<)",
"beginCaptures": {
"1": {
"name": "support.class.dart"
},
"2": {
"name": "entity.name.function.dart"
}
},
"patterns": [
{
"include": "#type-args"
}
]
}

]
},
"class-identifier": {
Expand Down Expand Up @@ -279,6 +321,10 @@
]
}
}
},
{
"match": "(?<=\\.)new\\b",
"name": "entity.name.function.dart"
}
]
},
Expand Down Expand Up @@ -334,8 +380,8 @@
"match": "(?<!\\$)\\bassert\\b(?!\\$)"
},
{
"name": "keyword.control.new.dart",
"match": "(?<!\\$)\\b(new)\\b(?!\\$)"
"name": "keyword.new.dart",
Comment thread
DanTup marked this conversation as resolved.
"match": "(?<![\\$\\.])\\b(new)\\b(?!\\$)"
},
{
"name": "keyword.control.return.dart",
Expand All @@ -351,7 +397,7 @@
},
{
"name": "storage.type.primitive.dart",
"match": "(?<!\\$)\\b(?:void|var)\\b(?!\\$)"
"match": "(?<!\\$)\\b(?:var)\\b(?!\\$)"
}
]
},
Expand Down Expand Up @@ -408,6 +454,12 @@
{
"include": "#constants-and-special-vars"
},
{
"include": "#class-identifier-with-optional-factory-method"
},
{
"include": "#function-identifier"
},
{
"include": "#strings"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,7 @@ class SyntaxHighlighter {
'keyword.control.catch-exception.dart',
'keyword.control.dart',
'keyword.control.return.dart',
// While 'new' is not a control flow keyword, it uses the control flow
// color scheme so we include it here.
'keyword.control.new.dart',
'keyword.new.dart',
];

const stringScopes = <String>[
Expand Down
2 changes: 2 additions & 0 deletions packages/devtools_app/release_notes/NEXT_RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ TODO: Remove this section if there are not any updates.

* Prevent values from being garbage-collected, while being evaluated.
[#9885](https://github.com/flutter/devtools/pull/9885)
* Update to latest version of the Dart syntax highlighting grammar
[#9920](https://github.com/flutter/devtools/pull/9920).

## Network profiler updates

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@
> var a = new String.fromCharCode(1);
# ^^^ storage.type.primitive.dart
# ^ keyword.operator.assignment.dart
# ^^^ keyword.control.new.dart
# ^^^ keyword.new.dart
# ^^^^^^ support.class.dart
# ^ punctuation.dot.dart
# ^^^^^^^^^^^^ entity.name.function.dart
Expand Down
Loading