1- import { AmbiguousIdentifierContext , EnumDeclarationContext , EnumMemberContext , FunctionDeclarationContext , ProcedureDeclarationContext , PropertyGetDeclarationContext , PropertySetDeclarationContext , PublicTypeDeclarationContext , SubroutineDeclarationContext , UdtDeclarationContext , UntypedNameContext } from '../../antlr/out/vbaParser' ;
2-
31import { TextDocument } from 'vscode-languageserver-textdocument' ;
2+ import { SemanticTokenModifiers , SemanticTokenTypes , SymbolInformation , SymbolKind } from 'vscode-languageserver' ;
3+ import { AmbiguousIdentifierContext , ConstItemContext , EnumDeclarationContext , EnumMemberContext , FunctionDeclarationContext , ProcedureDeclarationContext , PropertyGetDeclarationContext , PropertySetDeclarationContext , ReservedMemberNameContext , SubroutineDeclarationContext , UdtDeclarationContext , UdtElementContext , UntypedNameContext , VariableDclContext } from '../../antlr/out/vbaParser' ;
44
55import { BaseContextSyntaxElement , HasSemanticToken , HasSymbolInformation , IdentifiableSyntaxElement , NamedSyntaxElement } from './base' ;
6- import { SemanticTokenModifiers , SemanticTokenTypes , SymbolInformation , SymbolKind } from 'vscode-languageserver' ;
6+
77import { ScopeElement } from './special' ;
8+ import { VbaClassDocument , VbaModuleDocument } from '../document' ;
89import { SymbolInformationFactory } from '../../capabilities/symbolInformation' ;
910import '../../extensions/parserExtensions' ;
10- import { VbaClassDocument , VbaModuleDocument } from '../document' ;
11+
1112
1213
1314export class IdentifierElement extends BaseContextSyntaxElement {
14- constructor ( ctx : UntypedNameContext | AmbiguousIdentifierContext , doc : TextDocument ) {
15+ constructor ( ctx : UntypedNameContext | ConstItemContext | AmbiguousIdentifierContext | ReservedMemberNameContext , doc : TextDocument ) {
1516 super ( ctx , doc ) ;
1617 }
1718}
@@ -253,13 +254,16 @@ export class TypeDeclarationElement extends ScopeElement implements HasSemantic
253254 tokenModifiers : SemanticTokenModifiers [ ] = [ ] ;
254255 identifier : IdentifierElement ;
255256 symbolKind : SymbolKind ;
256- declaredNames : Map < string , IdentifiableSyntaxElement [ ] > = new Map ( ) ; // Get variable declarations going
257+ declaredNames : Map < string , TypeMemberDeclarationElement [ ] > = new Map ( ) ;
257258
258259 constructor ( context : UdtDeclarationContext , document : TextDocument ) {
259260 super ( context , document ) ;
260261 this . symbolKind = SymbolKind . Struct ;
261262 this . tokenType = SemanticTokenTypes . struct ;
262263 this . identifier = new IdentifierElement ( context . untypedName ( ) , document ) ;
264+ context . udtMemberList ( ) . udtElement ( ) . forEach ( member =>
265+ this . _pushDeclaredName ( new TypeMemberDeclarationElement ( member , document ) )
266+ ) ;
263267 }
264268
265269 get name ( ) : string { return this . identifier . text ; }
@@ -270,7 +274,20 @@ export class TypeDeclarationElement extends ScopeElement implements HasSemantic
270274 }
271275}
272276
273- // }
277+ export class TypeMemberDeclarationElement extends BaseVariableDeclarationStatementElement {
278+ tokenModifiers : SemanticTokenModifiers [ ] = [ ] ;
279+ identifier : IdentifierElement ;
280+
281+ get name ( ) : string {
282+ return this . identifier . text ;
283+ }
284+
285+ constructor ( context : UdtElementContext , document : TextDocument ) {
286+ super ( context , document , SemanticTokenTypes . property , SymbolKind . Property ) ;
287+ const identifierContext = context . udtMember ( ) ?. untypedNameMemberDcl ( ) ?. ambiguousIdentifier ( ) ?? context . udtMember ( ) ?. reservedNameMemberDcl ( ) ?. reservedMemberName ( ) ;
288+ this . identifier = new IdentifierElement ( identifierContext ! , document ) ;
289+ }
290+ }
274291
275292// export class VariableDeclarationsElement extends BaseVariableDeclarationStatementElement {
276293// declarations: VariableDeclarationElement[] = [];
0 commit comments