@@ -20,7 +20,8 @@ public void TokenizesFunctionElements()
2020 {
2121 const string text = @"
2222function Get-Sum {
23- param( [int]$a, [int]$b )
23+ param( [parameter()] [int]$a, [int]$b )
24+ :loopLabel while (0) {break loopLabel}
2425 return $a + $b
2526}
2627" ;
@@ -38,10 +39,21 @@ function Get-Sum {
3839 case "function" :
3940 case "param" :
4041 case "return" :
42+ case "while" :
43+ case "break" :
4144 Assert . Single ( mappedTokens , sToken => SemanticTokenType . Keyword == sToken . Type ) ;
4245 break ;
43- case "Get-Sum" :
44- Assert . Single ( mappedTokens , sToken => SemanticTokenType . Function == sToken . Type ) ;
46+ case "parameter" :
47+ Assert . Single ( mappedTokens , sToken => SemanticTokenType . Decorator == sToken . Type ) ;
48+ break ;
49+ case "0" :
50+ Assert . Single ( mappedTokens , sToken => SemanticTokenType . Number == sToken . Type ) ;
51+ break ;
52+ case ":loopLabel" :
53+ Assert . Single ( mappedTokens , sToken => SemanticTokenType . Label == sToken . Type ) ;
54+ break ;
55+ case "loopLabel" :
56+ Assert . Single ( mappedTokens , sToken => SemanticTokenType . Property == sToken . Type ) ;
4557 break ;
4658 case "$a" :
4759 case "$b" :
@@ -74,7 +86,6 @@ public void TokenizesStringExpansion()
7486 Token stringExpandableToken = scriptFile . ScriptTokens [ 1 ] ;
7587 mappedTokens = new List < SemanticToken > ( PsesSemanticTokensHandler . ConvertToSemanticTokens ( stringExpandableToken ) ) ;
7688 Assert . Collection ( mappedTokens ,
77- sToken => Assert . Equal ( SemanticTokenType . Function , sToken . Type ) ,
7889 sToken => Assert . Equal ( SemanticTokenType . Function , sToken . Type ) ,
7990 sToken => Assert . Equal ( SemanticTokenType . Function , sToken . Type )
8091 ) ;
0 commit comments