@@ -207,26 +207,46 @@ class EnumMemberDeclarationElement extends BaseEnumDeclarationElement {
207207 }
208208}
209209
210- // abstract class BaseVariableDeclarationStatementElement extends BaseContextSyntaxElement {
211- // abstract declarations: VariableDeclarationElement[];
210+ abstract class BaseVariableDeclarationStatementElement extends BaseContextSyntaxElement implements HasSemanticToken , HasSymbolInformation , NamedSyntaxElement {
211+ tokenType : SemanticTokenTypes ;
212+ tokenModifiers : SemanticTokenModifiers [ ] = [ ] ;
213+ readonly symbolKind : SymbolKind ;
214+
215+ abstract identifier : IdentifierElement ;
212216
213- // constructor(context: ConstStmtContext | VariableStmtContext, document: TextDocument) {
214- // super(context, document);
215- // }
216- // }
217+ get name ( ) : string {
218+ return this . identifier . text ;
219+ }
217220
218- // export class ConstDeclarationsElement extends BaseVariableDeclarationStatementElement {
219- // declarations: VariableDeclarationElement[] = [];
221+ get symbolInformation ( ) : SymbolInformation {
222+ return SymbolInformation . create (
223+ this . identifier . text ,
224+ this . symbolKind ,
225+ this . range ,
226+ this . document . uri
227+ ) ;
228+ }
220229
221- // constructor(context: ConstStmtContext, document: TextDocument) {
222- // super(context, document);
223- // context.constSubStmt().forEach((element) =>
224- // this.declarations.push(new VariableDeclarationElement(
225- // element, document
226- // ))
227- // );
228- // }
229- // }
230+ constructor ( context : VariableDclContext | ConstItemContext | UdtElementContext , document : TextDocument , tokenType : SemanticTokenTypes , symbolKind : SymbolKind ) {
231+ super ( context , document ) ;
232+ this . tokenType = tokenType ;
233+ this . symbolKind = symbolKind ;
234+ }
235+ }
236+
237+ export class ConstDeclarationElement extends BaseVariableDeclarationStatementElement {
238+ tokenModifiers : SemanticTokenModifiers [ ] = [ ] ;
239+ identifier : IdentifierElement ;
240+
241+ get name ( ) : string {
242+ return this . identifier . text ;
243+ }
244+
245+ constructor ( context : ConstItemContext , document : TextDocument ) {
246+ super ( context , document , SemanticTokenTypes . variable , SymbolKind . Constant ) ;
247+ this . identifier = new IdentifierElement ( context , document ) ;
248+ }
249+ }
230250
231251export class TypeDeclarationElement extends ScopeElement implements HasSemanticToken , HasSymbolInformation , NamedSyntaxElement {
232252 tokenType : SemanticTokenTypes ;
0 commit comments