@@ -33,10 +33,12 @@ internal class PsesSemanticTokensHandler : SemanticTokensHandler
33
33
} ) ,
34
34
RangeProvider = true
35
35
} ;
36
+
36
37
private readonly ILogger _logger ;
37
38
private readonly WorkspaceService _workspaceService ;
38
39
39
- public PsesSemanticTokensHandler ( ILogger < PsesSemanticTokensHandler > logger , WorkspaceService workspaceService ) : base ( s_registrationOptions )
40
+ public PsesSemanticTokensHandler ( ILogger < PsesSemanticTokensHandler > logger , WorkspaceService workspaceService )
41
+ : base ( s_registrationOptions )
40
42
{
41
43
_logger = logger ;
42
44
_workspaceService = workspaceService ;
@@ -59,7 +61,7 @@ private static void PushToken(Token token, SemanticTokensBuilder builder)
59
61
{
60
62
builder . Push (
61
63
sToken . Line ,
62
- sToken . Index ,
64
+ sToken . Column ,
63
65
length : sToken . Text . Length ,
64
66
sToken . Type ,
65
67
tokenModifiers : sToken . TokenModifiers ) ;
@@ -88,12 +90,13 @@ internal static IEnumerable<SemanticToken> ConvertToSemanticTokens(Token token)
88
90
yield break ;
89
91
}
90
92
91
- //Tokens line and col numbers indexed starting from 1, expecting indexing from 0
92
- int line = token . Extent . StartLineNumber - 1 ;
93
- int index = token . Extent . StartColumnNumber - 1 ;
94
- SemanticToken sToken = new SemanticToken ( token . Text , mappedType ,
95
- line , index , Array . Empty < string > ( ) ) ;
96
- yield return sToken ;
93
+ //Note that both column and line numbers are 0-based
94
+ yield return new SemanticToken (
95
+ token . Text ,
96
+ mappedType ,
97
+ line : token . Extent . StartLineNumber - 1 ,
98
+ column : token . Extent . StartColumnNumber - 1 ,
99
+ tokenModifiers : Array . Empty < string > ( ) ) ;
97
100
}
98
101
99
102
private static SemanticTokenType MapSemanticTokenType ( Token token )
0 commit comments