Class RDCorePlatformClient
The client's side of the RDCore platform protocol, over any IRDCorePlatformChannel: the handshake, the rdcore/session/* requests a client
sends, and the requests the language server sends a client, which it answers.
public sealed class RDCorePlatformClient
- Inheritance
-
RDCorePlatformClient
- Inherited Members
Remarks
A client connects to the language server, initializes it over LSP, then performs the platform handshake (InitializeAsync(CoreServerComponent, CorePlatformClientCapabilities, CancellationToken)), which says what it
expects of the platform beyond LSP. The language server relays a session/* request to the component that serves it - the environment host, for the
runtime session - and answers it once that component did.
The requests the language server sends a client are answered only by a client that registered for them (OnMessageBox(Func<SessionMessageBoxParams, CancellationToken, Task<MessageBoxResult>>), OnInputBox(Func<SessionInputBoxParams, CancellationToken, Task<InputBoxResult>>), OnRubberduckIndenterSettings(Func<RubberduckIndenterSettingsParams, CancellationToken, Task<RubberduckIndenterSettingsResult>>), OnRubberduckIndenterSettingsApply(Func<RubberduckIndenterSettingsApplyParams, CancellationToken, Task<RubberduckIndenterSettingsApplyResult>>), OnListSettingValue(Func<ListSettingValueParams, CancellationToken, Task<ListSettingValueResult>>)), and should be registered before the handshake says the client expects them: the language server may send one as soon as it is told. The same goes for the stops it tells a client of (OnDebugStopped(Func<SessionDebugStoppedParams, CancellationToken, Task>)).
Constructors
RDCorePlatformClient(IRDCorePlatformChannel)
The client's side of the RDCore platform protocol, over any IRDCorePlatformChannel: the handshake, the rdcore/session/* requests a client
sends, and the requests the language server sends a client, which it answers.
public RDCorePlatformClient(IRDCorePlatformChannel channel)
Parameters
channelIRDCorePlatformChannelThe connection to the language server.
Remarks
A client connects to the language server, initializes it over LSP, then performs the platform handshake (InitializeAsync(CoreServerComponent, CorePlatformClientCapabilities, CancellationToken)), which says what it
expects of the platform beyond LSP. The language server relays a session/* request to the component that serves it - the environment host, for the
runtime session - and answers it once that component did.
The requests the language server sends a client are answered only by a client that registered for them (OnMessageBox(Func<SessionMessageBoxParams, CancellationToken, Task<MessageBoxResult>>), OnInputBox(Func<SessionInputBoxParams, CancellationToken, Task<InputBoxResult>>), OnRubberduckIndenterSettings(Func<RubberduckIndenterSettingsParams, CancellationToken, Task<RubberduckIndenterSettingsResult>>), OnRubberduckIndenterSettingsApply(Func<RubberduckIndenterSettingsApplyParams, CancellationToken, Task<RubberduckIndenterSettingsApplyResult>>), OnListSettingValue(Func<ListSettingValueParams, CancellationToken, Task<ListSettingValueResult>>)), and should be registered before the handshake says the client expects them: the language server may send one as soon as it is told. The same goes for the stops it tells a client of (OnDebugStopped(Func<SessionDebugStoppedParams, CancellationToken, Task>)).
Properties
Channel
The connection this client speaks through.
public IRDCorePlatformChannel Channel { get; }
Property Value
Methods
CallToolAsync(ToolCallParams, CancellationToken)
Calls a tool the language server serves an assistant (ToolsCall).
public Task<ToolCallResult> CallToolAsync(ToolCallParams request, CancellationToken token)
Parameters
requestToolCallParamsThe tool, and its arguments.
tokenCancellationTokenCancels the call.
Returns
- Task<ToolCallResult>
What the tool answers; a refusal is a result whose IsError is true.
DebugBreakpointsAsync(SessionDebugBreakpointsParams, CancellationToken)
Sets the breakpoints of a module (SessionDebugBreakpoints).
public Task<DebugBreakpointsResult> DebugBreakpointsAsync(SessionDebugBreakpointsParams request, CancellationToken token)
Parameters
requestSessionDebugBreakpointsParamsThe module and its breakpoints: all of them, which replace the ones it had.
tokenCancellationTokenCancels the request.
Returns
- Task<DebugBreakpointsResult>
Each breakpoint as it was set: verified on a line that runs, or not.
DebugEditStatusAsync(SessionDebugEditStatusParams, CancellationToken)
Asks what the edits made while the program is suspended do to it (SessionDebugEditStatus).
public Task<DebugEditStatusResult> DebugEditStatusAsync(SessionDebugEditStatusParams request, CancellationToken token)
Parameters
requestSessionDebugEditStatusParamsThe request.
tokenCancellationTokenCancels the request.
Returns
- Task<DebugEditStatusResult>
Each edit, and what it takes to apply it.
DebugErrorBreakAsync(SessionDebugErrorBreakParams, CancellationToken)
Sets which run-time errors a program under a debugger waits at (SessionDebugErrorBreak).
public Task<DebugAck> DebugErrorBreakAsync(SessionDebugErrorBreakParams request, CancellationToken token)
Parameters
requestSessionDebugErrorBreakParamsThe errors to wait at, for this run and every later one.
tokenCancellationTokenCancels the request.
Returns
DebugEvaluateAsync(SessionDebugEvaluateParams, CancellationToken)
Evaluates an expression in a frame of the suspended program (SessionDebugEvaluate).
public Task<DebugEvaluateResult> DebugEvaluateAsync(SessionDebugEvaluateParams request, CancellationToken token)
Parameters
requestSessionDebugEvaluateParamsThe frame and the expression.
tokenCancellationTokenCancels the request.
Returns
- Task<DebugEvaluateResult>
The value, or the error the expression raised.
DebugExecuteAsync(SessionDebugExecuteParams, CancellationToken)
Runs a statement in a frame of the suspended program, as the Immediate window does (SessionDebugExecute).
public Task<DebugEvaluateResult> DebugExecuteAsync(SessionDebugExecuteParams request, CancellationToken token)
Parameters
requestSessionDebugExecuteParamsThe frame and the statement.
tokenCancellationTokenCancels the request.
Returns
- Task<DebugEvaluateResult>
Whether the statement ran, what it printed, or the error it raised.
DebugGotoAsync(SessionDebugGotoParams, CancellationToken)
Moves the next statement of the suspended program (SessionDebugGoto).
public Task<DebugGotoResult> DebugGotoAsync(SessionDebugGotoParams request, CancellationToken token)
Parameters
requestSessionDebugGotoParamsWhere to.
tokenCancellationTokenCancels the request.
Returns
- Task<DebugGotoResult>
Whether the next statement moved, where to, or why it did not.
DebugPauseAsync(SessionDebugPauseParams, CancellationToken)
Suspends the running program (SessionDebugPause).
public Task<DebugAck> DebugPauseAsync(SessionDebugPauseParams request, CancellationToken token)
Parameters
requestSessionDebugPauseParamsThe request.
tokenCancellationTokenCancels the request.
Returns
DebugResumeAsync(SessionDebugResumeParams, CancellationToken)
Resumes, or steps, the suspended program (SessionDebugResume).
public Task<ExecuteResult> DebugResumeAsync(SessionDebugResumeParams request, CancellationToken token)
Parameters
requestSessionDebugResumeParamsHow far to run.
tokenCancellationTokenCancels the request.
Returns
- Task<ExecuteResult>
How the program ran: suspended again, ended, or failed.
DebugStackAsync(SessionDebugStackParams, CancellationToken)
Asks for the call stack of the suspended program (SessionDebugStack).
public Task<DebugStackResult> DebugStackAsync(SessionDebugStackParams request, CancellationToken token)
Parameters
requestSessionDebugStackParamsThe request.
tokenCancellationTokenCancels the request.
Returns
- Task<DebugStackResult>
The frames, innermost first.
DebugTerminateAsync(SessionDebugTerminateParams, CancellationToken)
Ends the suspended program (SessionDebugTerminate).
public Task<DebugAck> DebugTerminateAsync(SessionDebugTerminateParams request, CancellationToken token)
Parameters
requestSessionDebugTerminateParamsWhether to wipe the session's state as well.
tokenCancellationTokenCancels the request.
Returns
DebugVariablesAsync(SessionDebugVariablesParams, CancellationToken)
Asks for the variables of a frame of the suspended program, or of an object (SessionDebugVariables).
public Task<DebugVariablesResult> DebugVariablesAsync(SessionDebugVariablesParams request, CancellationToken token)
Parameters
requestSessionDebugVariablesParamsThe frame, the scope, and the object.
tokenCancellationTokenCancels the request.
Returns
- Task<DebugVariablesResult>
The variables, with their values and types.
DiscardAsync(SessionDiscardParams, CancellationToken)
Discards a module of the runtime session (SessionDiscard).
public Task<DiscardResult> DiscardAsync(SessionDiscardParams request, CancellationToken token)
Parameters
requestSessionDiscardParamsThe module.
tokenCancellationTokenCancels the request.
Returns
- Task<DiscardResult>
How much was discarded.
ExecuteAsync(SessionExecuteParams, CancellationToken)
Runs code in the runtime session (SessionExecute).
public Task<ExecuteResult> ExecuteAsync(SessionExecuteParams request, CancellationToken token)
Parameters
requestSessionExecuteParamsThe code to run, and how.
tokenCancellationTokenCancels the request.
Returns
- Task<ExecuteResult>
How the code ran: completed, suspended, or failed, with what it printed.
InitializeAsync(CoreServerComponent, CorePlatformClientCapabilities, CancellationToken)
Performs the platform handshake (PlatformInitialize): says what the client expects of the component it connected to, and learns what that component provides.
public Task<PlatformInitializeResult> InitializeAsync(CoreServerComponent expectedComponent, CorePlatformClientCapabilities expected, CancellationToken token)
Parameters
expectedComponentCoreServerComponentThe component the client expects to be connected to: LanguageServer, for a client of the platform.
expectedCorePlatformClientCapabilitiesThe capabilities the client expects of it; a group left null is expected of no component.
tokenCancellationTokenCancels the request.
Returns
- Task<PlatformInitializeResult>
The component the client is connected to, and the capabilities it provides.
ListToolsAsync(CancellationToken)
Lists the tools the language server serves an assistant (ToolsList), in the language of the client's user interface.
public Task<ToolsListResult> ListToolsAsync(CancellationToken token)
Parameters
tokenCancellationTokenCancels the request.
Returns
- Task<ToolsListResult>
Each tool.
OnDebugStopped(Func<SessionDebugStoppedParams, CancellationToken, Task>)
Takes the stops of the handlers of events that run while no program runs (SessionDebugStopped), for a client that
expects SessionStops. The handler waits until the client resumes or ends it over rdcore/session/debug/*.
public IDisposable OnDebugStopped(Func<SessionDebugStoppedParams, CancellationToken, Task> handler)
Parameters
handlerFunc<SessionDebugStoppedParams, CancellationToken, Task>Shows where the handler stopped. It returns once it has: what the client does with the stop is a request of its own.
Returns
- IDisposable
The registration; disposing it stops taking them.
OnInputBox(Func<SessionInputBoxParams, CancellationToken, Task<InputBoxResult>>)
Shows the program's InputBox calls (SessionInputBox), for a client that expects SessionInteraction.
public IDisposable OnInputBox(Func<SessionInputBoxParams, CancellationToken, Task<InputBoxResult>> handler)
Parameters
handlerFunc<SessionInputBoxParams, CancellationToken, Task<InputBoxResult>>Shows an input box and answers what the user typed, or that they cancelled; NotHandled when it showed none.
Returns
- IDisposable
The registration; disposing it stops answering.
OnListSettingValue(Func<ListSettingValueParams, CancellationToken, Task<ListSettingValueResult>>)
Adds an item to the list of a setting, or removes one from it, as a change of the client's own (ListSettingValue), for a client that expects ListSettingValue.
public IDisposable OnListSettingValue(Func<ListSettingValueParams, CancellationToken, Task<ListSettingValueResult>> handler)
Parameters
handlerFunc<ListSettingValueParams, CancellationToken, Task<ListSettingValueResult>>Changes the list where Scope says it is kept, and says whether it did.
Returns
- IDisposable
The registration; disposing it stops answering.
OnMessageBox(Func<SessionMessageBoxParams, CancellationToken, Task<MessageBoxResult>>)
Shows the program's MsgBox calls (SessionMessageBox), for a client that expects SessionInteraction.
public IDisposable OnMessageBox(Func<SessionMessageBoxParams, CancellationToken, Task<MessageBoxResult>> handler)
Parameters
handlerFunc<SessionMessageBoxParams, CancellationToken, Task<MessageBoxResult>>Shows a message box and answers the button the user chose; NotHandled when it showed none.
Returns
- IDisposable
The registration; disposing it stops answering.
OnRubberduckIndenterSettings(Func<RubberduckIndenterSettingsParams, CancellationToken, Task<RubberduckIndenterSettingsResult>>)
Answers what the client finds of the user's Rubberduck indenter settings (RubberduckIndenterSettings), for a client that expects RubberduckIndenterSettings.
public IDisposable OnRubberduckIndenterSettings(Func<RubberduckIndenterSettingsParams, CancellationToken, Task<RubberduckIndenterSettingsResult>> handler)
Parameters
handlerFunc<RubberduckIndenterSettingsParams, CancellationToken, Task<RubberduckIndenterSettingsResult>>Reads the settings, as they are; Nothing when there are none.
Returns
- IDisposable
The registration; disposing it stops answering.
OnRubberduckIndenterSettingsApply(Func<RubberduckIndenterSettingsApplyParams, CancellationToken, Task<RubberduckIndenterSettingsApplyResult>>)
Takes the Formatting settings the language server mapped from them as the client's own (RubberduckIndenterSettingsApply),
for a client that expects RubberduckIndenterSettings.
public IDisposable OnRubberduckIndenterSettingsApply(Func<RubberduckIndenterSettingsApplyParams, CancellationToken, Task<RubberduckIndenterSettingsApplyResult>> handler)
Parameters
handlerFunc<RubberduckIndenterSettingsApplyParams, CancellationToken, Task<RubberduckIndenterSettingsApplyResult>>Sets the settings, and says how many it set and which it did not.
Returns
- IDisposable
The registration; disposing it stops answering.
PeekAsync(SessionPeekParams, CancellationToken)
Reads a byte of the runtime session's memory (SessionPeek).
public Task<PeekResult> PeekAsync(SessionPeekParams request, CancellationToken token)
Parameters
requestSessionPeekParamsThe address.
tokenCancellationTokenCancels the request.
Returns
- Task<PeekResult>
The byte, and whether the address is allocated.
PokeAsync(SessionPokeParams, CancellationToken)
Writes a byte of the runtime session's memory (SessionPoke).
public Task<PokeResult> PokeAsync(SessionPokeParams request, CancellationToken token)
Parameters
requestSessionPokeParamsThe address and the value.
tokenCancellationTokenCancels the request.
Returns
- Task<PokeResult>
Whether the byte was written.
RefactorApplyAsync(RefactorApplyParams, CancellationToken)
Asks for the edit a refactoring makes with its user's answers (RefactorApply), which the client applies. A refactoring that is refused, or whose answers it refuses, fails the request, its message saying why in the language of the user interface.
public Task<RefactorWorkspaceEdit> RefactorApplyAsync(RefactorApplyParams request, CancellationToken token)
Parameters
requestRefactorApplyParamsThe refactoring, the document and range it is of, the user's answers, and the changes the user accepts.
tokenCancellationTokenCancels the request.
Returns
- Task<RefactorWorkspaceEdit>
The edit of the workspace, which the language server does not apply.
RefactorCheckIdentifierAsync(RefactorIdentifierCheckParams, CancellationToken)
Asks about an identifier the user is typing for a refactoring, before it is applied (RefactorCheckIdentifier): whether it can be declared where the refactoring declares it, and what it would hide, which a dialog shows beside it as its user types it.
public Task<RefactorIdentifierCheckResult> RefactorCheckIdentifierAsync(RefactorIdentifierCheckParams request, CancellationToken token)
Parameters
requestRefactorIdentifierCheckParamsThe refactoring, the document and range it is of, and the user's answers, whose Name choices hold the identifiers.
tokenCancellationTokenCancels the request.
Returns
- Task<RefactorIdentifierCheckResult>
The notices the identifiers raise, each with the choice it answers: an identifier the refactoring refuses, or what the user should know of one it takes.
RefactorPrepareAsync(RefactorPrepareParams, CancellationToken)
Asks what a refactoring of a document's range asks its user, and what it refuses or would change (RefactorPrepare), for a client that expects Refactoring: what its dialog shows.
public Task<RefactorPrepareResult> RefactorPrepareAsync(RefactorPrepareParams request, CancellationToken token)
Parameters
requestRefactorPrepareParamsThe refactoring, by its kind, and the document and range it is of.
tokenCancellationTokenCancels the request.
Returns
- Task<RefactorPrepareResult>
The choices, each with its default, and the notices: the refusals, the changes the user accepts, and what the user should know.
StatusAsync(SessionStatusParams, CancellationToken)
Asks for the state of the runtime session (SessionStatus).
public Task<SessionStatusResult> StatusAsync(SessionStatusParams request, CancellationToken token)
Parameters
requestSessionStatusParamsThe request.
tokenCancellationTokenCancels the request.
Returns
- Task<SessionStatusResult>
Whether the session is composed, its project, and its memory.