Skip to content

Commit 4a321c4

Browse files
authored
Fix highlighting of comments inside type args/parameters (dart-lang#46)
* Add a test with comments inside type parameters/arguments This records the current state for dart-lang#45, but doesn't fix it. * Fix highlighting of comments inside type args
1 parent 7e56dc1 commit 4a321c4

File tree

4 files changed

+35
-1
lines changed

4 files changed

+35
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.2.1 (2023-05-04)
2+
3+
- Fixed highlighting of comments inside type arguments.
4+
15
## 1.2.0 (2023-01-30)
26

37
- Added support for class modifiers.

grammars/dart.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Dart",
3-
"version": "1.2.0",
3+
"version": "1.2.1",
44
"fileTypes": [
55
"dart"
66
],
@@ -302,6 +302,9 @@
302302
{
303303
"name": "keyword.declaration.dart",
304304
"match": "extends"
305+
},
306+
{
307+
"include": "#comments"
305308
}
306309
]
307310
},

test/goldens/comments.dart.golden

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,25 @@
102102
>var h;
103103
#^^^ storage.type.primitive.dart
104104
# ^ punctuation.terminator.dart
105+
>
106+
>class A<dynamic /* comment */ > {
107+
#^^^^^ keyword.declaration.dart
108+
# ^ support.class.dart
109+
# ^ other.source.dart
110+
# ^^^^^^^ support.class.dart
111+
# ^^^^^^^^^^^^^ comment.block.dart
112+
# ^ other.source.dart
113+
> void b<dynamic /* comment */ >() {}
114+
# ^^^^ storage.type.primitive.dart
115+
# ^ keyword.operator.comparison.dart
116+
# ^^^^^^^ support.class.dart
117+
# ^^^^^^^^^^^^^ comment.block.dart
118+
# ^ keyword.operator.comparison.dart
119+
> Future<dynamic /* comment */ > c() {}
120+
# ^^^^^^ support.class.dart
121+
# ^ other.source.dart
122+
# ^^^^^^^ support.class.dart
123+
# ^^^^^^^^^^^^^ comment.block.dart
124+
# ^ other.source.dart
125+
# ^ entity.name.function.dart
126+
>}

test/test_files/comments.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,8 @@ var g;
4646
/// Dartdoc with reference to [a].
4747
/// And a link to [example.org](http://example.org/).
4848
var h;
49+
50+
class A<dynamic /* comment */ > {
51+
void b<dynamic /* comment */ >() {}
52+
Future<dynamic /* comment */ > c() {}
53+
}

0 commit comments

Comments
 (0)