@@ -128,6 +128,7 @@ func (t *semanticTokenizer) add(tok highlightedToken) {
128
128
}
129
129
130
130
func (t * semanticTokenizer ) VisitVarDecl (d * ast.VarDecl ) ast.VisitResult {
131
+ t .add (newHightlightedToken (d .TypeRange , t .doc , protocol .SemanticTokenTypeType , nil ))
131
132
t .add (newHightlightedToken (token .NewRange (& d .NameTok , & d .NameTok ), t .doc , protocol .SemanticTokenTypeVariable , nil ))
132
133
return ast .VisitRecurse
133
134
}
@@ -138,6 +139,11 @@ func (t *semanticTokenizer) VisitFuncDecl(d *ast.FuncDecl) ast.VisitResult {
138
139
name := & d .Parameters [i ].Name
139
140
t .add (newHightlightedToken (token .NewRange (name , name ), t .doc , protocol .SemanticTokenTypeParameter , nil ))
140
141
}
142
+ for i := range d .Parameters {
143
+ typeRange := d .Parameters [i ].TypeRange
144
+ t .add (newHightlightedToken (typeRange , t .doc , protocol .SemanticTokenTypeType , nil ))
145
+ }
146
+ t .add (newHightlightedToken (d .ReturnTypeRange , t .doc , protocol .SemanticTokenTypeType , nil ))
141
147
return ast .VisitRecurse
142
148
}
143
149
@@ -152,6 +158,18 @@ func (t *semanticTokenizer) VisitStructDecl(d *ast.StructDecl) ast.VisitResult {
152
158
return ast .VisitSkipChildren
153
159
}
154
160
161
+ func (t * semanticTokenizer ) VisitTypeAliasDecl (d * ast.TypeAliasDecl ) ast.VisitResult {
162
+ t .add (newHightlightedToken (d .UnderlyingRange , t .doc , protocol .SemanticTokenTypeClass , nil ))
163
+ t .add (newHightlightedToken (d .NameTok .Range , t .doc , protocol .SemanticTokenTypeClass , nil ))
164
+ return ast .VisitRecurse
165
+ }
166
+
167
+ func (t * semanticTokenizer ) VisitTypeDefDecl (d * ast.TypeDefDecl ) ast.VisitResult {
168
+ t .add (newHightlightedToken (d .NameTok .Range , t .doc , protocol .SemanticTokenTypeClass , nil ))
169
+ t .add (newHightlightedToken (d .UnderlyingRange , t .doc , protocol .SemanticTokenTypeClass , nil ))
170
+ return ast .VisitRecurse
171
+ }
172
+
155
173
func (t * semanticTokenizer ) VisitIdent (e * ast.Ident ) ast.VisitResult {
156
174
t .add (newHightlightedToken (e .GetRange (), t .doc , protocol .SemanticTokenTypeVariable , nil ))
157
175
return ast .VisitRecurse
0 commit comments