@@ -90,7 +90,8 @@ class SemanticTokensTest extends AbstractLspAnalysisServerTest {
90
90
_Token ('import' , SemanticTokenTypes .keyword),
91
91
_Token ("'other_file.dart'" , SemanticTokenTypes .string),
92
92
_Token ('as' , SemanticTokenTypes .keyword),
93
- _Token ('other' , SemanticTokenTypes .variable),
93
+ _Token ('other' , SemanticTokenTypes .variable,
94
+ [CustomSemanticTokenModifiers .importPrefix]),
94
95
_Token ('@' , CustomSemanticTokenTypes .annotation),
95
96
_Token ('a' , SemanticTokenTypes .property,
96
97
[CustomSemanticTokenModifiers .annotation]),
@@ -117,14 +118,16 @@ class SemanticTokensTest extends AbstractLspAnalysisServerTest {
117
118
[CustomSemanticTokenModifiers .constructor]),
118
119
_Token (')' , CustomSemanticTokenTypes .annotation),
119
120
_Token ('@' , CustomSemanticTokenTypes .annotation),
120
- _Token ('other' , SemanticTokenTypes .variable),
121
+ _Token ('other' , SemanticTokenTypes .variable,
122
+ [CustomSemanticTokenModifiers .importPrefix]),
121
123
_Token ('.' , CustomSemanticTokenTypes .annotation),
122
124
_Token ('C' , SemanticTokenTypes .class_,
123
125
[CustomSemanticTokenModifiers .annotation]),
124
126
_Token ('(' , CustomSemanticTokenTypes .annotation),
125
127
_Token (')' , CustomSemanticTokenTypes .annotation),
126
128
_Token ('@' , CustomSemanticTokenTypes .annotation),
127
- _Token ('other' , SemanticTokenTypes .variable),
129
+ _Token ('other' , SemanticTokenTypes .variable,
130
+ [CustomSemanticTokenModifiers .importPrefix]),
128
131
_Token ('.' , CustomSemanticTokenTypes .annotation),
129
132
_Token ('C' , SemanticTokenTypes .class_,
130
133
[CustomSemanticTokenModifiers .annotation]),
@@ -214,26 +217,26 @@ class SemanticTokensTest extends AbstractLspAnalysisServerTest {
214
217
_Token ('MyClass' , SemanticTokenTypes .class_,
215
218
[CustomSemanticTokenModifiers .constructor]),
216
219
_Token ('final' , SemanticTokenTypes .keyword),
217
- _Token ('a' , SemanticTokenTypes .variable ,
220
+ _Token ('a' , SemanticTokenTypes .property ,
218
221
[SemanticTokenModifiers .declaration]),
219
222
_Token ('MyClass' , SemanticTokenTypes .class_,
220
223
[CustomSemanticTokenModifiers .constructor]),
221
224
_Token ('final' , SemanticTokenTypes .keyword),
222
- _Token ('b' , SemanticTokenTypes .variable ,
225
+ _Token ('b' , SemanticTokenTypes .property ,
223
226
[SemanticTokenModifiers .declaration]),
224
227
_Token ('MyClass' , SemanticTokenTypes .class_,
225
228
[CustomSemanticTokenModifiers .constructor]),
226
229
_Token ('named' , SemanticTokenTypes .method,
227
230
[CustomSemanticTokenModifiers .constructor]),
228
231
_Token ('final' , SemanticTokenTypes .keyword),
229
- _Token ('c' , SemanticTokenTypes .variable ,
232
+ _Token ('c' , SemanticTokenTypes .property ,
230
233
[SemanticTokenModifiers .declaration]),
231
234
_Token ('MyClass' , SemanticTokenTypes .class_,
232
235
[CustomSemanticTokenModifiers .constructor]),
233
236
_Token ('factory' , SemanticTokenTypes .method,
234
237
[CustomSemanticTokenModifiers .constructor]),
235
238
_Token ('final' , SemanticTokenTypes .keyword),
236
- _Token ('d' , SemanticTokenTypes .variable ,
239
+ _Token ('d' , SemanticTokenTypes .property ,
237
240
[SemanticTokenModifiers .declaration]),
238
241
_Token ('MyClass' , SemanticTokenTypes .class_),
239
242
_Token ('named' , SemanticTokenTypes .method,
@@ -584,7 +587,7 @@ class SemanticTokensTest extends AbstractLspAnalysisServerTest {
584
587
plugin.HighlightRegion (plugin.HighlightRegionType .CLASS , 0 , 5 ),
585
588
plugin.HighlightRegion (plugin.HighlightRegionType .LITERAL_STRING , 6 , 6 ),
586
589
plugin.HighlightRegion (
587
- plugin.HighlightRegionType .TOP_LEVEL_VARIABLE_DECLARATION , 13 , 8 ),
590
+ plugin.HighlightRegionType .LOCAL_VARIABLE_DECLARATION , 13 , 8 ),
588
591
],
589
592
);
590
593
configureTestPlugin (notification: pluginResult.toNotification ());
@@ -684,11 +687,11 @@ class SemanticTokensTest extends AbstractLspAnalysisServerTest {
684
687
}
685
688
686
689
Future <void > test_lastLine_code () async {
687
- final content = 'String var ;' ;
690
+ final content = 'String bar ;' ;
688
691
689
692
final expected = [
690
693
_Token ('String' , SemanticTokenTypes .class_),
691
- _Token ('var ' , SemanticTokenTypes .variable ,
694
+ _Token ('bar ' , SemanticTokenTypes .property ,
692
695
[SemanticTokenModifiers .declaration]),
693
696
];
694
697
@@ -1032,12 +1035,12 @@ multi
1032
1035
_Token ('c' , SemanticTokenTypes .parameter),
1033
1036
1034
1037
_Token ('const' , SemanticTokenTypes .keyword),
1035
- _Token ('string1' , SemanticTokenTypes .variable ,
1038
+ _Token ('string1' , SemanticTokenTypes .property ,
1036
1039
[SemanticTokenModifiers .declaration]),
1037
1040
_Token ("'test'" , SemanticTokenTypes .string),
1038
1041
1039
1042
_Token ('const' , SemanticTokenTypes .keyword),
1040
- _Token ('string2' , SemanticTokenTypes .variable ,
1043
+ _Token ('string2' , SemanticTokenTypes .property ,
1041
1044
[SemanticTokenModifiers .declaration]),
1042
1045
_Token (r"'test1 " , SemanticTokenTypes .string),
1043
1046
_Token (r'$' , CustomSemanticTokenTypes .source,
@@ -1059,12 +1062,12 @@ multi
1059
1062
1060
1063
// string3 is raw and should be treated as a single string.
1061
1064
_Token ('const' , SemanticTokenTypes .keyword),
1062
- _Token ('string3' , SemanticTokenTypes .variable ,
1065
+ _Token ('string3' , SemanticTokenTypes .property ,
1063
1066
[SemanticTokenModifiers .declaration]),
1064
1067
_Token (r"r'$string1 ${string1.length}'" , SemanticTokenTypes .string),
1065
1068
_Token ('const' , SemanticTokenTypes .keyword),
1066
1069
1067
- _Token ('string4' , SemanticTokenTypes .variable ,
1070
+ _Token ('string4' , SemanticTokenTypes .property ,
1068
1071
[SemanticTokenModifiers .declaration]),
1069
1072
_Token ("'''\n " , SemanticTokenTypes .string),
1070
1073
_Token ('multi\n ' , SemanticTokenTypes .string),
@@ -1092,7 +1095,7 @@ const string3 = 'unicode \u1234\u123499\u{123456}\u{12345699}';
1092
1095
1093
1096
final expected = [
1094
1097
_Token ('const' , SemanticTokenTypes .keyword),
1095
- _Token ('string1' , SemanticTokenTypes .variable ,
1098
+ _Token ('string1' , SemanticTokenTypes .property ,
1096
1099
[SemanticTokenModifiers .declaration]),
1097
1100
_Token ("'it" , SemanticTokenTypes .string),
1098
1101
_Token (r"\'" , SemanticTokenTypes .string,
@@ -1104,7 +1107,7 @@ const string3 = 'unicode \u1234\u123499\u{123456}\u{12345699}';
1104
1107
[CustomSemanticTokenModifiers .escape]),
1105
1108
_Token (r"'" , SemanticTokenTypes .string),
1106
1109
_Token ('const' , SemanticTokenTypes .keyword),
1107
- _Token ('string2' , SemanticTokenTypes .variable ,
1110
+ _Token ('string2' , SemanticTokenTypes .property ,
1108
1111
[SemanticTokenModifiers .declaration]),
1109
1112
_Token ("'hex " , SemanticTokenTypes .string),
1110
1113
_Token (r'\x12' , SemanticTokenTypes .string,
@@ -1114,7 +1117,7 @@ const string3 = 'unicode \u1234\u123499\u{123456}\u{12345699}';
1114
1117
// The 99 is not part of the escape
1115
1118
_Token ("99'" , SemanticTokenTypes .string),
1116
1119
_Token ('const' , SemanticTokenTypes .keyword),
1117
- _Token ('string3' , SemanticTokenTypes .variable ,
1120
+ _Token ('string3' , SemanticTokenTypes .property ,
1118
1121
[SemanticTokenModifiers .declaration]),
1119
1122
_Token ("'unicode " , SemanticTokenTypes .string),
1120
1123
_Token (r'\u1234' , SemanticTokenTypes .string,
@@ -1149,13 +1152,20 @@ const string3 = 'unicode \u1234\u123499\u{123456}\u{12345699}';
1149
1152
bool get abc => true;
1150
1153
1151
1154
final funcTearOff = func;
1155
+
1156
+ void main() {
1157
+ strings;
1158
+ func;
1159
+ abc;
1160
+ funcTearOff;
1161
+ }
1152
1162
''' ;
1153
1163
1154
1164
final expected = [
1155
1165
_Token ('/// strings docs' , SemanticTokenTypes .comment,
1156
1166
[SemanticTokenModifiers .documentation]),
1157
1167
_Token ('const' , SemanticTokenTypes .keyword),
1158
- _Token ('strings' , SemanticTokenTypes .variable ,
1168
+ _Token ('strings' , SemanticTokenTypes .property ,
1159
1169
[SemanticTokenModifiers .declaration]),
1160
1170
_Token ('String' , SemanticTokenTypes .class_),
1161
1171
_Token ('"test"' , SemanticTokenTypes .string),
@@ -1179,9 +1189,17 @@ const string3 = 'unicode \u1234\u123499\u{123456}\u{12345699}';
1179
1189
[SemanticTokenModifiers .declaration]),
1180
1190
_Token ('true' , CustomSemanticTokenTypes .boolean),
1181
1191
_Token ('final' , SemanticTokenTypes .keyword),
1182
- _Token ('funcTearOff' , SemanticTokenTypes .variable ,
1192
+ _Token ('funcTearOff' , SemanticTokenTypes .property ,
1183
1193
[SemanticTokenModifiers .declaration]),
1184
1194
_Token ('func' , SemanticTokenTypes .function),
1195
+ _Token ('void' , SemanticTokenTypes .keyword,
1196
+ [CustomSemanticTokenModifiers .void_]),
1197
+ _Token ('main' , SemanticTokenTypes .function,
1198
+ [SemanticTokenModifiers .declaration, SemanticTokenModifiers .static ]),
1199
+ _Token ('strings' , SemanticTokenTypes .property),
1200
+ _Token ('func' , SemanticTokenTypes .function),
1201
+ _Token ('abc' , SemanticTokenTypes .property),
1202
+ _Token ('funcTearOff' , SemanticTokenTypes .property),
1185
1203
];
1186
1204
1187
1205
await initialize ();
0 commit comments