pub struct Client { /* private fields */ }Expand description
Handle for communicating with the language client.
Implementations§
Source§impl Client
impl Client
Sourcepub async fn register_capability(
&self,
registrations: Vec<Registration>,
) -> Result<()>
pub async fn register_capability( &self, registrations: Vec<Registration>, ) -> Result<()>
Registers a new capability with the client.
This corresponds to the client/registerCapability request.
§Initialization
If the request is sent to the client before the server has been initialized, this will
immediately return Err with JSON-RPC error code -32002 (read more).
Sourcepub async fn unregister_capability(
&self,
unregisterations: Vec<Unregistration>,
) -> Result<()>
pub async fn unregister_capability( &self, unregisterations: Vec<Unregistration>, ) -> Result<()>
Unregisters a capability with the client.
This corresponds to the client/unregisterCapability request.
§Initialization
If the request is sent to the client before the server has been initialized, this will
immediately return Err with JSON-RPC error code -32002 (read more).
Sourcepub async fn show_message<M: Display>(&self, typ: MessageType, message: M)
pub async fn show_message<M: Display>(&self, typ: MessageType, message: M)
Notifies the client to display a particular message in the user interface.
This corresponds to the window/showMessage notification.
Sourcepub async fn show_message_request<M: Display>(
&self,
typ: MessageType,
message: M,
actions: Option<Vec<MessageActionItem>>,
) -> Result<Option<MessageActionItem>>
pub async fn show_message_request<M: Display>( &self, typ: MessageType, message: M, actions: Option<Vec<MessageActionItem>>, ) -> Result<Option<MessageActionItem>>
Requests the client to display a particular message in the user interface.
Unlike the show_message notification, this request can also pass a list of actions and
wait for an answer from the client.
This corresponds to the window/showMessageRequest request.
Sourcepub async fn log_message<M: Display>(&self, typ: MessageType, message: M)
pub async fn log_message<M: Display>(&self, typ: MessageType, message: M)
Notifies the client to log a particular message.
This corresponds to the window/logMessage notification.
Sourcepub async fn log_trace(&self, params: LogTraceParams)
pub async fn log_trace(&self, params: LogTraceParams)
Notifies the client to log a trace.
This corresponds to the $/logTrace notification.
Sourcepub async fn show_document(&self, params: ShowDocumentParams) -> Result<bool>
pub async fn show_document(&self, params: ShowDocumentParams) -> Result<bool>
Asks the client to display a particular resource referenced by a URI in the user interface.
Returns Ok(true) if the document was successfully shown, or Ok(false) otherwise.
This corresponds to the window/showDocument request.
§Initialization
If the request is sent to the client before the server has been initialized, this will
immediately return Err with JSON-RPC error code -32002 (read more).
§Compatibility
This request was introduced in specification version 3.16.0.
Sourcepub async fn work_done_progress_create(
&self,
params: WorkDoneProgressCreateParams,
) -> Result<()>
pub async fn work_done_progress_create( &self, params: WorkDoneProgressCreateParams, ) -> Result<()>
Asks the client to create a work done progress token.
This corresponds to the window/workDoneProgress/create request.
§Compatibility
This request was introduced in specification version 3.15.0.
Sourcepub async fn telemetry_event<S: Serialize>(&self, data: S)
pub async fn telemetry_event<S: Serialize>(&self, data: S)
Notifies the client to log a telemetry event.
This corresponds to the telemetry/event notification.
Sourcepub async fn code_lens_refresh(&self) -> Result<()>
pub async fn code_lens_refresh(&self) -> Result<()>
Asks the client to refresh the code lenses currently shown in editors. As a result, the client should ask the server to recompute the code lenses for these editors.
This is useful if a server detects a configuration change which requires a re-calculation of all code lenses.
Note that the client still has the freedom to delay the re-calculation of the code lenses if for example an editor is currently not visible.
This corresponds to the workspace/codeLens/refresh request.
§Initialization
If the request is sent to the client before the server has been initialized, this will
immediately return Err with JSON-RPC error code -32002 (read more).
§Compatibility
This request was introduced in specification version 3.16.0.
Sourcepub async fn semantic_tokens_refresh(&self) -> Result<()>
pub async fn semantic_tokens_refresh(&self) -> Result<()>
Asks the client to refresh the editors for which this server provides semantic tokens. As a result, the client should ask the server to recompute the semantic tokens for these editors.
This is useful if a server detects a project-wide configuration change which requires a re-calculation of all semantic tokens. Note that the client still has the freedom to delay the re-calculation of the semantic tokens if for example an editor is currently not visible.
This corresponds to the workspace/semanticTokens/refresh request.
§Initialization
If the request is sent to the client before the server has been initialized, this will
immediately return Err with JSON-RPC error code -32002 (read more).
§Compatibility
This request was introduced in specification version 3.16.0.
Sourcepub async fn inline_value_refresh(&self) -> Result<()>
pub async fn inline_value_refresh(&self) -> Result<()>
Asks the client to refresh the inline values currently shown in editors. As a result, the client should ask the server to recompute the inline values for these editors.
This is useful if a server detects a configuration change which requires a re-calculation of all inline values. Note that the client still has the freedom to delay the re-calculation of the inline values if for example an editor is currently not visible.
This corresponds to the workspace/inlineValue/refresh request.
§Initialization
If the request is sent to the client before the server has been initialized, this will
immediately return Err with JSON-RPC error code -32002 (read more).
§Compatibility
This request was introduced in specification version 3.17.0.
Sourcepub async fn inlay_hint_refresh(&self) -> Result<()>
pub async fn inlay_hint_refresh(&self) -> Result<()>
Asks the client to refresh the inlay hints currently shown in editors. As a result, the client should ask the server to recompute the inlay hints for these editors.
This is useful if a server detects a configuration change which requires a re-calculation of all inlay hints. Note that the client still has the freedom to delay the re-calculation of the inlay hints if for example an editor is currently not visible.
This corresponds to the workspace/inlayHint/refresh request.
§Initialization
If the request is sent to the client before the server has been initialized, this will
immediately return Err with JSON-RPC error code -32002 (read more).
§Compatibility
This request was introduced in specification version 3.17.0.
Sourcepub async fn folding_range_refresh(&self) -> Result<()>
pub async fn folding_range_refresh(&self) -> Result<()>
Asks the client to refresh all folding ranges.
This corresponds to the workspace/foldingRange/refresh request.
§Initialization
If the request is sent to the client before the server has been initialized, this will
immediately return Err with JSON-RPC error code -32002 (read more).
§Compatibility
This request was introduced in specification version 3.18.0.
Sourcepub async fn workspace_diagnostic_refresh(&self) -> Result<()>
pub async fn workspace_diagnostic_refresh(&self) -> Result<()>
Asks the client to refresh all needed document and workspace diagnostics.
This is useful if a server detects a project wide configuration change which requires a re-calculation of all diagnostics.
This corresponds to the workspace/diagnostic/refresh request.
§Initialization
If the request is sent to the client before the server has been initialized, this will
immediately return Err with JSON-RPC error code -32002 (read more).
§Compatibility
This request was introduced in specification version 3.17.0.
Sourcepub async fn text_document_content_refresh(
&self,
params: TextDocumentContentRefreshParams,
) -> Result<()>
pub async fn text_document_content_refresh( &self, params: TextDocumentContentRefreshParams, ) -> Result<()>
Asks the client to refresh the content of a text document.
This corresponds to the workspace/textDocumentContent/refresh request.
Sourcepub async fn publish_diagnostics(
&self,
uri: Uri,
diags: Vec<Diagnostic>,
version: Option<i32>,
)
pub async fn publish_diagnostics( &self, uri: Uri, diags: Vec<Diagnostic>, version: Option<i32>, )
Submits validation diagnostics for an open file with the given URI.
This corresponds to the textDocument/publishDiagnostics notification.
§Initialization
This notification will only be sent if the server is initialized.
Sourcepub async fn andon_raised(&self, event: AndonEvent)
pub async fn andon_raised(&self, event: AndonEvent)
lspMax/andonRaised notification
Sourcepub async fn admission_changed(&self, status: String)
pub async fn admission_changed(&self, status: String)
lspMax/admissionChanged notification
Sourcepub async fn truth_table_changed(&self, uri: String)
pub async fn truth_table_changed(&self, uri: String)
lspMax/truthTableChanged notification
Sourcepub async fn counterfactual_failed(&self, invariant_id: String)
pub async fn counterfactual_failed(&self, invariant_id: String)
lspMax/counterfactualFailed notification
Sourcepub async fn next_lawful_step_changed(&self, step: String)
pub async fn next_lawful_step_changed(&self, step: String)
lspMax/nextLawfulStepChanged notification
Sourcepub async fn configuration(
&self,
items: Vec<ConfigurationItem>,
) -> Result<Vec<Value>>
pub async fn configuration( &self, items: Vec<ConfigurationItem>, ) -> Result<Vec<Value>>
Fetches configuration settings from the client.
The request can fetch several configuration settings in one roundtrip. The order of the
returned configuration settings correspond to the order of the passed
ConfigurationItems (e.g. the first item in the response is the result for the first
configuration item in the params).
This corresponds to the workspace/configuration request.
§Initialization
If the request is sent to the client before the server has been initialized, this will
immediately return Err with JSON-RPC error code -32002 (read more).
§Compatibility
This request was introduced in specification version 3.6.0.
Sourcepub async fn workspace_folders(&self) -> Result<Option<Vec<WorkspaceFolder>>>
pub async fn workspace_folders(&self) -> Result<Option<Vec<WorkspaceFolder>>>
Fetches the current open list of workspace folders.
Returns None if only a single file is open in the tool. Returns an empty Vec if a
workspace is open but no folders are configured.
This corresponds to the workspace/workspaceFolders request.
§Initialization
If the request is sent to the client before the server has been initialized, this will
immediately return Err with JSON-RPC error code -32002 (read more).
§Compatibility
This request was introduced in specification version 3.6.0.
Sourcepub async fn apply_edit(
&self,
edit: WorkspaceEdit,
) -> Result<ApplyWorkspaceEditResponse>
pub async fn apply_edit( &self, edit: WorkspaceEdit, ) -> Result<ApplyWorkspaceEditResponse>
Requests a workspace resource be edited on the client side and returns whether the edit was applied.
This corresponds to the workspace/applyEdit request.
§Initialization
If the request is sent to the client before the server has been initialized, this will
immediately return Err with JSON-RPC error code -32002 (read more).
Sourcepub fn progress<T>(&self, token: ProgressToken, title: T) -> Progress
pub fn progress<T>(&self, token: ProgressToken, title: T) -> Progress
Starts a stream of $/progress notifications for a client-provided ProgressToken.
This method also takes a title argument briefly describing the kind of operation being
performed, e.g. “Indexing” or “Linking Dependencies”.
§Initialization
These notifications will only be sent if the server is initialized.
Source§impl Client
impl Client
Sourcepub async fn cancel_request(&self, id: NumberOrString)
pub async fn cancel_request(&self, id: NumberOrString)
Sends a $/cancelRequest notification to the client.
This notification is sent from the server to the client to cancel a specific request previously sent by the server.
§Initialization
This notification will only be sent if the server is initialized.
Sourcepub async fn work_done_progress_cancel(&self, token: ProgressToken)
pub async fn work_done_progress_cancel(&self, token: ProgressToken)
Sends a window/workDoneProgress/cancel notification to the client.
This notification is sent from the server to the client to inform it that the server has cancelled a specific work done progress.
§Initialization
This notification will only be sent if the server is initialized.
Sourcepub async fn set_trace(&self, value: TraceValue)
pub async fn set_trace(&self, value: TraceValue)
Sends a $/setTrace notification to the client.
This notification is used to modify the trace setting of the client.
§Initialization
This notification will only be sent if the server is initialized.
Source§impl Client
impl Client
Sourcepub async fn send_notification<N>(&self, params: N::Params)where
N: Notification,
pub async fn send_notification<N>(&self, params: N::Params)where
N: Notification,
Sends a custom notification to the client.
Trait Implementations§
Source§impl Service<Request> for Client
impl Service<Request> for Client
Source§type Error = ExitedError
type Error = ExitedError
Source§type Future = Pin<Box<dyn Future<Output = Result<<Client as Service<Request>>::Response, <Client as Service<Request>>::Error>> + Send>>
type Future = Pin<Box<dyn Future<Output = Result<<Client as Service<Request>>::Response, <Client as Service<Request>>::Error>> + Send>>
Auto Trait Implementations§
impl !RefUnwindSafe for Client
impl !UnwindSafe for Client
impl Freeze for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl UnsafeUnpin for Client
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> EvidenceKind for T
impl<T> EvidenceKind for T
default fn kind_label(&self) -> &'static str
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> OnDrop for T
impl<T> OnDrop for T
Source§fn on_drop<F: FnOnce()>(self, on_drop: F) -> (Self, CancellationGuard<F>)
fn on_drop<F: FnOnce()>(self, on_drop: F) -> (Self, CancellationGuard<F>)
CancellationGuard that will call the given
closure when dropped.Source§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);Source§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T, Request> ServiceExt<Request> for T
impl<T, Request> ServiceExt<Request> for T
Source§fn ready(&mut self) -> Ready<'_, Self, Request>where
Self: Sized,
fn ready(&mut self) -> Ready<'_, Self, Request>where
Self: Sized,
Source§fn ready_and(&mut self) -> Ready<'_, Self, Request>where
Self: Sized,
fn ready_and(&mut self) -> Ready<'_, Self, Request>where
Self: Sized,
please use the ServiceExt::ready method instead
Source§fn ready_oneshot(self) -> ReadyOneshot<Self, Request>where
Self: Sized,
fn ready_oneshot(self) -> ReadyOneshot<Self, Request>where
Self: Sized,
Source§fn oneshot(self, req: Request) -> Oneshot<Self, Request>where
Self: Sized,
fn oneshot(self, req: Request) -> Oneshot<Self, Request>where
Self: Sized,
Service, calling with the providing request once it is ready.Source§fn and_then<F>(self, f: F) -> AndThen<Self, F>
fn and_then<F>(self, f: F) -> AndThen<Self, F>
poll_ready method. Read moreSource§fn map_response<F, Response>(self, f: F) -> MapResponse<Self, F>
fn map_response<F, Response>(self, f: F) -> MapResponse<Self, F>
poll_ready method. Read moreSource§fn map_err<F, Error>(self, f: F) -> MapErr<Self, F>
fn map_err<F, Error>(self, f: F) -> MapErr<Self, F>
poll_ready method. Read moreSource§fn map_result<F, Response, Error>(self, f: F) -> MapResult<Self, F>
fn map_result<F, Response, Error>(self, f: F) -> MapResult<Self, F>
Result<Self::Response, Self::Error>)
to a different value, regardless of whether the future succeeds or
fails. Read more