Class DefineSymbolsParams
- Namespace
- RDCore.SDK.Platform.Components
- Assembly
- RDCore.SDK.dll
Request for rdcore/host/symbols/define: the language server sends the environment host the
member symbols one workspace module declares, as descriptors. The host reconstructs a runtime
Symbol from each, resolves its declared type name against its own session, and
defines it in the session symbol table.
[Method("rdcore/host/symbols/define", Direction.ClientToServer)]
public record DefineSymbolsParams : IRequest, IRequest<Unit>, IRequest<DefineSymbolsResult>, IBaseRequest, IEquatable<DefineSymbolsParams>
- Inheritance
-
DefineSymbolsParams
- Implements
-
IRequestIRequest<Unit>IRequest<DefineSymbolsResult>IBaseRequest
- Inherited Members
Remarks
Module symbols are not carried here: the host already has them from the .rdproj.
The descriptors are the transport form of what the language server's SyntaxTreeSymbolProvider
produces. A name declared in several conditional-compilation branches arrives as one descriptor
carrying every branch in Definitions; the host defines the single
symbol and leaves live/dead branch selection to a later pass.
Part of the component protocol (RDCoreComponentProtocol), outside the SDK's compatibility promise.
Properties
CodeOnly
Whether the module's symbols were defined by an earlier request, and this one is for its code alone: the host defines nothing, and loads the module's procedures from ParseResultJson.
public bool CodeOnly { get; init; }
Property Value
Remarks
A module's code is checked against what the whole workspace declares (RD-VBAL §5.0.1), and the host is told of the modules one at a time: a module that names one that comes after it cannot be checked until that one is defined. The language server defines every module first, and then sends the code of each. See DeclareTypesOnly for the three phases.
DeclareTypesOnly
Whether this request declares the module's types alone - its user-defined types with their fields, and its enumerations with their members - and nothing else is defined, composed or loaded.
public bool DeclareTypesOnly { get; init; }
Property Value
Remarks
A workspace is defined in three phases, each for every module before the next: its types are declared (this), then its declarations are bound (a request that is neither this nor CodeOnly), then its code is loaded (CodeOnly). A declaration is bound to a type that exists, whichever module declares it and in whichever order a project lists its modules: a class module exists as soon as the project is composed, and a user-defined type or an enumeration once this phase has declared it. A request that binds a module's declarations declares its types first, so that a module defined on its own (the shell's program) is right too; the types the declare phase gave the session are there already.
Directives
The module's own Option directives (MS-VBAL §5.2.1), which the host
applies to its module symbol.
public ModuleDirectives Directives { get; init; }
Property Value
Remarks
These are run-time dials, not only static ones: Option Compare decides how the relational
operators compare String values in the module's code, and Option Base decides what
an array dimension declared without a lower bound means. Both are read off the activation's own
call-stack frame, which gets them from the module symbol the procedure is declared in.
ImplementedInterfaceNames
The names of the interfaces the module's Implements directives name
(MS-VBAL §5.2.4.2), as written and in source order; empty for a module that has none, and for one that
is not a class module.
public ImmutableArray<string> ImplementedInterfaceNames { get; init; }
Property Value
Remarks
The host composes the class from them once its members are defined
(TryComposeClassModule(string, ImmutableArray<string>, ImmutableArray<SourceRange>)), resolving each to the class it
names among the class modules it has: an object of the class is then an object that implements the interface, which is
what a call through a variable declared as the interface is dispatched on (§5.3.1.9), and what a
TypeOf ... Is and a Set to such a variable are decided by.
ImplementedInterfaceRanges
Where each of ImplementedInterfaceNames is written in the module: the range of its Implements directive,
one for each name and in the same order, or empty when they are not known.
public ImmutableArray<SourceRange> ImplementedInterfaceRanges { get; init; }
Property Value
ModuleName
The module's name. The member symbols attach under the module symbol of this name in the session.
public string ModuleName { get; init; }
Property Value
ModuleUri
The Uri of the module these symbols belong to. Informational: the host re-derives the
parent module symbol from WorkspaceRoot and ModuleName.
public Uri? ModuleUri { get; init; }
Property Value
ParseResultJson
The System.Text.Json representation of the module's ModuleParseResult (see PlatformJson), or empty when the module is defined for its symbols alone.
public string ParseResultJson { get; init; }
Property Value
Remarks
What gives the module's procedures code. A module the host is asked to run carries its parse result with that request and is loaded then; a module of the workspace is never run as such, but its procedures are called by the ones that are, and its class members by the objects that are made of it. The AST is polymorphic, which is why it rides a string and not the transport's own serializer.
PrecompilerTriviaJson
The PlatformJson representation of the module's conditional-compilation directives (PrecompilerTrivia), or empty when the module has none or the caller does not send them.
public string PrecompilerTriviaJson { get; init; }
Property Value
Remarks
What lets the host define the declarations of the live #If branches only (MS-VBAL §3.4): it evaluates the directives with the
session's constants, and of a declaration written once per branch - a procedure, a Declare, a field of a Type - it defines the one of
the live branch; one written only in dead branches is not defined. Without them, every declaration is defined as the first branch writes it.
Replace
Whether a descriptor replaces an already-defined symbol of the same identity rather than being skipped.
public bool Replace { get; init; }
Property Value
Remarks
The one-shot workspace sync defines each module once, and first-definition-wins is what collapses a name declared in several conditional-compilation branches. A module the user is editing is the other case: it is defined again every time it is run, and the newest definition is the one that is true: skipping it would leave the session running yesterday's symbols, with whatever locals and declared types they had.
SessionModule
Whether the module is the client's own, of the runtime session and not of the project (SessionModule): when the session has no module of ModuleName, the host defines it as a standard module at WorkspaceRoot, outside the project, before it defines the module's members, unless it is named after the project or a library the session references. Without it, the members of a module the session does not have are defined under no module, and the module is not found.
public bool SessionModule { get; init; }
Property Value
Symbols
The member symbol descriptors, in declaration order.
[JsonIgnore]
public ImmutableArray<SymbolDescriptor> Symbols { get; init; }
Property Value
Remarks
Not on the wire as such: a descriptor carries expressions (Value, DefaultValue, ArrayBoundDescriptor), which the transport's serializer cannot write - and a request it cannot write is never sent, nor ever answered. They travel as SymbolsJson.
SymbolsJson
The System.Text.Json representation of Symbols (see PlatformJson): the form they take on the wire.
[JsonIgnore]
public string SymbolsJson { get; init; }
Property Value
Remarks
An AST node is polymorphic, and the literal one holds a value whose type holds a value of that type; Newtonsoft.Json refuses the first and loops on
the second. Setting it sets Symbols.
WorkspaceRoot
The workspace root the module and its symbols are addressed under. Matches the root the host
composed its session with, so reconstructed symbol Uris line up with the module symbol.
The root of a project the host composed for analysis (HostProjectAnalyzeParams)
defines the module in that project, and the runtime session is left as it is.
public Uri? WorkspaceRoot { get; init; }
Property Value
Methods
PrecompilerTriviaJsonOf(ModuleParseResult)
The PrecompilerTriviaJson of a module parsed: empty when it has no directive.
public static string PrecompilerTriviaJsonOf(ModuleParseResult parseResult)
Parameters
parseResultModuleParseResultThe module's parse.