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

Update Dart grammar for extension type highlighting and other fixes #6837

Merged
Merged
Show file tree
Hide file tree
Changes from 5 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
21 changes: 8 additions & 13 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.2.0",
"version": "1.2.5",
"fileTypes": [
"dart"
],
Expand Down Expand Up @@ -93,15 +93,7 @@
"end": "```"
},
{
"match": "(`.*?`)",
"captures": {
"0": {
"name": "variable.other.source.dart"
}
}
},
{
"match": "(`.*?`)",
"match": "(`[^`]+?`)",
"captures": {
"0": {
"name": "variable.other.source.dart"
Expand Down Expand Up @@ -302,6 +294,9 @@
{
"name": "keyword.declaration.dart",
"match": "extends"
},
{
"include": "#comments"
}
]
},
Expand Down Expand Up @@ -333,7 +328,7 @@
},
{
"name": "keyword.declaration.dart",
"match": "(?<!\\$)\\b(abstract|sealed|base|interface|class|enum|extends|extension|external|factory|implements|get(?!\\()|mixin|native|operator|set(?!\\()|typedef|with|covariant)\\b(?!\\$)"
"match": "(?<!\\$)\\b(abstract|sealed|base|interface|class|enum|extends|extension type|extension|external|factory|implements|get(?!\\()|mixin|native|operator|set(?!\\()|typedef|with|covariant)\\b(?!\\$)"
},
{
"name": "storage.modifier.dart",
Expand Down Expand Up @@ -396,6 +391,7 @@
"string-interp": {
"patterns": [
{
"name": "string.interpolated.expression.dart",
"match": "\\$([a-zA-Z0-9_]+)",
"captures": {
"1": {
Expand All @@ -409,8 +405,7 @@
"end": "\\}",
"patterns": [
{
"include": "#constants-and-special-vars",
"name": "variable.parameter.dart"
"include": "#constants-and-special-vars"
},
{
"include": "#strings"
Expand Down
6 changes: 4 additions & 2 deletions packages/devtools_app/release_notes/NEXT_RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ TODO: Remove this section if there are not any general updates.

## Debugger updates

TODO: Remove this section if there are not any general updates.
* Highlight `extension type` as a declaration keyword,
highlight the `$` in identifier interpolation as part of the interpolation,
and properly highlight comments within type arguments.
parlough marked this conversation as resolved.
Show resolved Hide resolved
parlough marked this conversation as resolved.
Show resolved Hide resolved

## Network profiler updates

Expand All @@ -58,7 +60,7 @@ TODO: Remove this section if there are not any general updates.
the current project. This also requires a corresponding Dart extension for
VS Code update to appear
- [#6688](https://github.com/flutter/devtools/pull/6688)
* The DevTools menu in the sidebar now has now has an entry "Open in Browser"
* The DevTools menu in the sidebar now has an entry "Open in Browser"
that opens DevTools in an external browser window even when VS Code settings
are set to usually use embedded DevTools.
- [#6736](https://github.com/flutter/devtools/pull/6736)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,14 @@ void main() {
spanTester(
context,
children[i++] as TextSpan,
"'\$",
"'",
stringSyntaxColor,
);

spanTester(
context,
children[i++] as TextSpan,
'\$',
stringSyntaxColor,
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@
# ^ keyword.operator.assignment.dart
# ^^ string.interpolated.single.dart
# ^ punctuation.comma.dart
# ^^ string.interpolated.single.dart
# ^ string.interpolated.single.dart variable.parameter.dart
# ^ string.interpolated.single.dart
# ^ string.interpolated.single.dart string.interpolated.expression.dart
# ^ string.interpolated.single.dart string.interpolated.expression.dart variable.parameter.dart
# ^ string.interpolated.single.dart
# ^ punctuation.terminator.dart
>const list4 = <String>['', '$a'];
Expand All @@ -39,8 +40,9 @@
# ^ keyword.operator.comparison.dart
# ^^ string.interpolated.single.dart
# ^ punctuation.comma.dart
# ^^ string.interpolated.single.dart
# ^ string.interpolated.single.dart variable.parameter.dart
# ^ string.interpolated.single.dart
# ^ string.interpolated.single.dart string.interpolated.expression.dart
# ^ string.interpolated.single.dart string.interpolated.expression.dart variable.parameter.dart
# ^ string.interpolated.single.dart
# ^ punctuation.terminator.dart
>
Expand All @@ -60,8 +62,9 @@
# ^ keyword.operator.assignment.dart
# ^^ string.interpolated.single.dart
# ^ punctuation.comma.dart
# ^^ string.interpolated.single.dart
# ^ string.interpolated.single.dart variable.parameter.dart
# ^ string.interpolated.single.dart
# ^ string.interpolated.single.dart string.interpolated.expression.dart
# ^ string.interpolated.single.dart string.interpolated.expression.dart variable.parameter.dart
# ^ string.interpolated.single.dart
# ^ punctuation.terminator.dart
>const set4 = <String>{'', '$a'};
Expand All @@ -72,8 +75,9 @@
# ^ keyword.operator.comparison.dart
# ^^ string.interpolated.single.dart
# ^ punctuation.comma.dart
# ^^ string.interpolated.single.dart
# ^ string.interpolated.single.dart variable.parameter.dart
# ^ string.interpolated.single.dart
# ^ string.interpolated.single.dart string.interpolated.expression.dart
# ^ string.interpolated.single.dart string.interpolated.expression.dart variable.parameter.dart
# ^ string.interpolated.single.dart
# ^ punctuation.terminator.dart
>
Expand All @@ -91,8 +95,9 @@
# ^ keyword.operator.assignment.dart
# ^^ string.interpolated.single.dart
# ^ keyword.operator.ternary.dart
# ^^ string.interpolated.single.dart
# ^ string.interpolated.single.dart variable.parameter.dart
# ^ string.interpolated.single.dart
# ^ string.interpolated.single.dart string.interpolated.expression.dart
# ^ string.interpolated.single.dart string.interpolated.expression.dart variable.parameter.dart
# ^ string.interpolated.single.dart
# ^ punctuation.terminator.dart
>const map3 = <String, String>{'': '$a'};
Expand All @@ -105,7 +110,8 @@
# ^ keyword.operator.comparison.dart
# ^^ string.interpolated.single.dart
# ^ keyword.operator.ternary.dart
# ^^ string.interpolated.single.dart
# ^ string.interpolated.single.dart variable.parameter.dart
# ^ string.interpolated.single.dart
# ^ string.interpolated.single.dart string.interpolated.expression.dart
# ^ string.interpolated.single.dart string.interpolated.expression.dart variable.parameter.dart
# ^ string.interpolated.single.dart
# ^ punctuation.terminator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@
# ^^^^^ entity.name.function.dart
# ^^^^^^^^^^^^^^ string.interpolated.single.dart
# ^^ string.interpolated.single.dart constant.character.escape.dart
# ^^^^^^ string.interpolated.single.dart
# ^ string.interpolated.single.dart variable.parameter.dart
# ^^^^^ string.interpolated.single.dart
# ^ string.interpolated.single.dart string.interpolated.expression.dart
# ^ string.interpolated.single.dart string.interpolated.expression.dart variable.parameter.dart
# ^ string.interpolated.single.dart
# ^ punctuation.terminator.dart
> print('the value after \$i is ${i + 1}');
Expand Down