Skip to content

Commit ff8d98e

Browse files
committed
Added property type to name in SymbolInformation
1 parent 402381a commit ff8d98e

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

server/src/project/elements/memory.ts

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import { TextDocument } from 'vscode-languageserver-textdocument';
22
import { Diagnostic, SemanticTokenModifiers, SemanticTokenTypes, SymbolInformation, SymbolKind } from 'vscode-languageserver';
33
import { AmbiguousIdentifierContext, ConstItemContext, EnumDeclarationContext, EnumMemberContext, FunctionDeclarationContext, ProcedureDeclarationContext, PropertyGetDeclarationContext, PropertySetDeclarationContext, ReservedMemberNameContext, SubroutineDeclarationContext, UdtDeclarationContext, UdtElementContext, UntypedNameContext, VariableDclContext } from '../../antlr/out/vbaParser';
44

5-
import { BaseContextSyntaxElement, HasDiagnosticCapability, HasSemanticToken, HasSymbolInformation, IdentifiableSyntaxElement, NamedSyntaxElement } from './base';
5+
import { BaseContextSyntaxElement, HasDiagnosticCapability, HasSemanticToken, HasSymbolInformation, NamedSyntaxElement } from './base';
66

77
import { ScopeElement } from './special';
8-
import { BaseProjectDocument, VbaClassDocument, VbaModuleDocument } from '../document';
8+
import { VbaClassDocument, VbaModuleDocument } from '../document';
99
import { SymbolInformationFactory } from '../../capabilities/symbolInformation';
1010
import '../../extensions/parserExtensions';
1111
import { DuplicateDeclarationDiagnostic } from '../../capabilities/diagnostics';
@@ -120,9 +120,10 @@ export class PropertyDeclarationElement extends DeclarationElement implements Ha
120120

121121
constructor(context: ProcedureDeclarationContext, document: TextDocument) {
122122
super(context, document);
123-
this.identifier = this.addPropertyDeclaration(context, document);
123+
const identifier = this.addPropertyDeclaration(context, document);
124+
this.identifier = identifier.value
124125
this.symbolInformation = SymbolInformation.create(
125-
this.identifier.text,
126+
`${identifier.type} ${this.identifier.text}`,
126127
SymbolKind.Property,
127128
this.range,
128129
this.document.uri
@@ -134,20 +135,26 @@ export class PropertyDeclarationElement extends DeclarationElement implements Ha
134135
}
135136

136137
addPropertyDeclaration(context: ProcedureDeclarationContext, document: TextDocument) {
138+
let property: PropertyGetDeclarationElement | PropertyLetDeclarationElement | PropertySetDeclarationElement;
139+
let propertyType: string;
137140
switch (true) {
138141
case !!context.propertyGetDeclaration():
139-
// Property Get
142+
propertyType = 'Get';
143+
property = new PropertyGetDeclarationElement(context, document, context.propertyGetDeclaration()!);
140144
this.getDeclarations.push(new PropertyGetDeclarationElement(context, document, context.propertyGetDeclaration()!));
141-
return this.getDeclarations[0].identifier;
145+
break;
142146
case !!context.propertySetDeclaration()?.LET():
143-
// Property Let
144-
this.letDeclarations.push(new PropertyLetDeclarationElement(context, document, context.propertySetDeclaration()!));
145-
return this.letDeclarations[0].identifier;
147+
propertyType = 'Let';
148+
property = new PropertyLetDeclarationElement(context, document, context.propertySetDeclaration()!);
149+
this.letDeclarations.push(property);
150+
break;
146151
default:
147-
// Property Set
152+
propertyType = 'Set';
153+
property = new PropertyLetDeclarationElement(context, document, context.propertySetDeclaration()!);
148154
this.setDeclarations.push(new PropertySetDeclarationElement(context, document, context.propertySetDeclaration()!));
149-
return this.setDeclarations[0].identifier;
155+
break;
150156
}
157+
return { type: propertyType, value: property.identifier };
151158
}
152159

153160
private _evaluateDuplicateDeclarationsDiagnostics(): void {

0 commit comments

Comments
 (0)