2.5.1 Runtime Entities
A runtime entity is a simple abstraction that associates a VBType with a Symbol.
Because a runtime entity associates a Symbol, every RD-VBA runtime entity is addressable with a Uri that is unique across the workspace.
2.5.1.1 Symbols
A symbol necessarily has a Uri and a Name. A symbol also has a ScopeKind and an (extended) LSP symbol kind, SymbolKindExt.
| Member | Meaning |
|---|---|
Uri |
A semantic ID that uniquely identifies the symbol across the workspace. |
Name |
The symbol's name. |
ScopeKind |
How, and whether, the symbol is allocated in memory. |
SymbolKindExt |
The (extended) LSP symbol kind of the symbol. |
Uri
The Uri of a symbol is a semantic ID that uniquely identifies the symbol across an entire workspace. Symbol Uri namespaces are defined in the SDK; see RDCoreUriNamespaces.
A symbol Uri is assembled from the workspace root Uri and a relative Uri:
- The relative
Urimay include a fragment. The content of the fragment is implementation-defined. - The relative
Uripath should be that of the symbol's parent module or procedure scope.
Warning
Symbol Uris are hierarchical, but they should never be used to rebuild a client-side tree-like structure.
Name resolution is described in RD-VBAL §2.3.1.3 Name Resolution.
Name
- The
Nameof a symbol defined in workspace source code must be a valid identifier name. - The
Nameof a static symbol corresponds to its identifier name, if the static symbol has one. - A static symbol that has no identifier name (an operator, for example) should have a
Namethat clearly is not a legal VBA name. This avoids any possible confusion with a VBA name.
Scope Kind
ScopeKind defines the allocation scopes. The scope kind of a Symbol determines how, and whether, the symbol is allocated in memory.
| Value | Level | Allocation |
|---|---|---|
Unallocated |
A pseudo-scope for pseudo-symbols. | Not allocated in memory. Example: VBVoidValue. |
Global |
Mostly StaticSymbol instances and symbols obtained from referenced libraries. | Lives in the globals heap. |
Local |
Procedure level. | Scoped to the local ICallStackFrame. |
Module |
Module level. | Lives in the workspace statics heap. |
Instance |
Instance level. | Lives in the object heap. |
External |
Allocated externally. | Lives out of process, at a known address. |
The heaps and the services that manage them are described in RD-VBAL §2.3.1.2 Session Services.
Symbol Kind
The symbol kind of a Symbol is as specified in LSP 3.17. The symbol kinds RD-VBA uses are the members of SymbolKindExt, each with an LSP SymbolKind equivalent:
| RD-VBA symbol kind | LSP equivalent |
|---|---|
Module |
SymbolKind.Module |
Project |
SymbolKind.Namespace |
Class |
SymbolKind.Class |
Procedure |
SymbolKind.Method |
Field |
SymbolKind.Field |
Enum |
SymbolKind.Enum |
Interface |
SymbolKind.Interface |
Function |
SymbolKind.Function |
Variable |
SymbolKind.Variable |
Constant |
SymbolKind.Constant |
StringLiteral |
SymbolKind.String |
NumberLiteral |
SymbolKind.Number |
BooleanLiteral |
SymbolKind.Boolean |
Array |
SymbolKind.Array |
Object |
SymbolKind.Object |
Key |
SymbolKind.Key |
Null |
SymbolKind.Null |
EnumMember |
SymbolKind.EnumMember |
UserDefinedType |
SymbolKind.Struct |
Event |
SymbolKind.Event |
Operator |
SymbolKind.Operator |
Tip
The LSP standard symbol kinds File, Constructor and TypeParameter are not used in RD-VBA.
RD-VBA repurposes the LSP Namespace symbol kind to a different meaning: the RD-VBA Project symbol kind maps to SymbolKind.Namespace. There is no concept of a namespace in VBA.
The token that follows the ! operator in a dictionary access expression represents a dictionary key, which the LSP Key symbol kind would fit; see RD-VBAL §5.6.14 Dictionary Access Expressions.
Extension Symbol Kinds
🧩 RD-VBA additionally defines the following extension symbol kinds in SymbolKindExt:
IgnoredAttributeDirectiveLineLabelDateLiteralVariantLiteralTypeDescriptor
The extension symbol kinds may or may not be supported by an LSP client (editor). When a client supports them, they help it supply more precise hover tips.
Typed and Member Symbols
ITypedSymbol unifies bound and unbound typed symbols; see RD-VBAL §5.6.10 Simple Name Expressions.
VBReturningMemberSymbol is the base type of a Function's and a Property Get's member symbol. Const, EnumConst, module-level and instance fields, and UDT fields share this base type with Function and Property Get symbols.
VBProcedureMemberSymbol.Locals and VBReturningMemberSymbol.Locals list every Dim, Static and Const declared in the procedure body. The Locals property of a procedure member symbol mirrors its Parameters property; see RD-VBAL §5.4.3.1 Local Variable Declarations.
A class module with VB_PredeclaredId = True has a VBPredeclaredInstanceSymbol: a global variable named after the class, whose declared type is that class. It is an automatic instantiation variable (SymbolProperties.AutoInstantiated, MS-VBAL §2.5.1 Automatic Object Instantiation), as is any variable declared with an As New clause. See RD-VBAL §3.1.1 Attributes and RD-VBAL §5.2.3 Module Declarations.
⏮️ RD-VBAL §2.5 Runtime Values | ⏭️ RD-VBAL §2.5.2 VBTypedValue