From cf927c1ceef0ec40b8f182ce60819368c8105e5e Mon Sep 17 00:00:00 2001 From: Parker Lougheed Date: Mon, 27 Nov 2023 14:17:35 -0600 Subject: [PATCH 1/5] Update Dart grammar for extension type highlighting and other fixes --- packages/devtools_app/assets/dart_syntax.json | 21 +++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/packages/devtools_app/assets/dart_syntax.json b/packages/devtools_app/assets/dart_syntax.json index eb3cc305bf1..6f1a0421627 100644 --- a/packages/devtools_app/assets/dart_syntax.json +++ b/packages/devtools_app/assets/dart_syntax.json @@ -1,6 +1,6 @@ { "name": "Dart", - "version": "1.2.0", + "version": "1.2.5", "fileTypes": [ "dart" ], @@ -93,15 +93,7 @@ "end": "```" }, { - "match": "(`.*?`)", - "captures": { - "0": { - "name": "variable.other.source.dart" - } - } - }, - { - "match": "(`.*?`)", + "match": "(`[^`]+?`)", "captures": { "0": { "name": "variable.other.source.dart" @@ -302,6 +294,9 @@ { "name": "keyword.declaration.dart", "match": "extends" + }, + { + "include": "#comments" } ] }, @@ -333,7 +328,7 @@ }, { "name": "keyword.declaration.dart", - "match": "(? Date: Mon, 27 Nov 2023 14:38:44 -0600 Subject: [PATCH 2/5] Add to changelog --- packages/devtools_app/release_notes/NEXT_RELEASE_NOTES.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/devtools_app/release_notes/NEXT_RELEASE_NOTES.md b/packages/devtools_app/release_notes/NEXT_RELEASE_NOTES.md index 69c55d6c1cd..425275f2d2a 100644 --- a/packages/devtools_app/release_notes/NEXT_RELEASE_NOTES.md +++ b/packages/devtools_app/release_notes/NEXT_RELEASE_NOTES.md @@ -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. ## Network profiler updates @@ -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) From f6b981480701f911aba6ca53cc667e7d2cd436b3 Mon Sep 17 00:00:00 2001 From: Parker Lougheed Date: Tue, 28 Nov 2023 12:41:12 -0600 Subject: [PATCH 3/5] Update syntax highlighter tests for identifier interpolation change --- .../test/shared/syntax_highlighter_test.dart | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/devtools_app/test/shared/syntax_highlighter_test.dart b/packages/devtools_app/test/shared/syntax_highlighter_test.dart index 12b7dfe22f4..22d6a132d02 100644 --- a/packages/devtools_app/test/shared/syntax_highlighter_test.dart +++ b/packages/devtools_app/test/shared/syntax_highlighter_test.dart @@ -433,7 +433,14 @@ void main() { spanTester( context, children[i++] as TextSpan, - "'\$", + "'", + stringSyntaxColor, + ); + + spanTester( + context, + children[i++] as TextSpan, + '\$', stringSyntaxColor, ); From fed1992de3b68c0e365f0c36feae2bb302ea9f8e Mon Sep 17 00:00:00 2001 From: Parker Lougheed Date: Tue, 28 Nov 2023 12:46:38 -0600 Subject: [PATCH 4/5] Update goldens as well --- .../syntax_highlighting/literals.dart.golden | 30 +++++++++++-------- .../string_interpolation.dart.golden | 5 ++-- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/packages/devtools_app/test/test_infra/goldens/syntax_highlighting/literals.dart.golden b/packages/devtools_app/test/test_infra/goldens/syntax_highlighting/literals.dart.golden index f0da6730d0c..bbe961afa5d 100644 --- a/packages/devtools_app/test/test_infra/goldens/syntax_highlighting/literals.dart.golden +++ b/packages/devtools_app/test/test_infra/goldens/syntax_highlighting/literals.dart.golden @@ -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 = ['', '$a']; @@ -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 > @@ -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 = {'', '$a'}; @@ -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 > @@ -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 = {'': '$a'}; @@ -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 diff --git a/packages/devtools_app/test/test_infra/goldens/syntax_highlighting/string_interpolation.dart.golden b/packages/devtools_app/test/test_infra/goldens/syntax_highlighting/string_interpolation.dart.golden index d411646615c..cc0a78fdf5b 100644 --- a/packages/devtools_app/test/test_infra/goldens/syntax_highlighting/string_interpolation.dart.golden +++ b/packages/devtools_app/test/test_infra/goldens/syntax_highlighting/string_interpolation.dart.golden @@ -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}'); From f51630cfa9fae8a32354e43dc0ec1170f4fbcef6 Mon Sep 17 00:00:00 2001 From: Parker Lougheed Date: Wed, 29 Nov 2023 17:06:05 -0600 Subject: [PATCH 5/5] Add link to PR Co-authored-by: Kenzie Davisson <43759233+kenzieschmoll@users.noreply.github.com> --- packages/devtools_app/release_notes/NEXT_RELEASE_NOTES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/devtools_app/release_notes/NEXT_RELEASE_NOTES.md b/packages/devtools_app/release_notes/NEXT_RELEASE_NOTES.md index 4e5b71307fd..fd00cce0a54 100644 --- a/packages/devtools_app/release_notes/NEXT_RELEASE_NOTES.md +++ b/packages/devtools_app/release_notes/NEXT_RELEASE_NOTES.md @@ -39,7 +39,7 @@ 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. + and properly highlight comments within type arguments. - [6837](https://github.com/flutter/devtools/pull/6837) ## Network profiler updates