pub struct LspClient { /* private fields */ }Expand description
A client connected to one language server process.
Implementations§
Source§impl LspClient
impl LspClient
Sourcepub fn spawn(
kind: ServerKind,
root: PathBuf,
binary: &Path,
args: &[String],
env: &HashMap<String, String>,
event_tx: Sender<LspEvent>,
child_registry: LspChildRegistry,
) -> Result<Self>
pub fn spawn( kind: ServerKind, root: PathBuf, binary: &Path, args: &[String], env: &HashMap<String, String>, event_tx: Sender<LspEvent>, child_registry: LspChildRegistry, ) -> Result<Self>
Spawn a new language server process and start the background reader thread.
child_registry is a shared handle that records this child’s PID so
the signal handler can SIGKILL it on SIGTERM/SIGINT. Tests that don’t
care about signal cleanup can pass LspChildRegistry::new().
Sourcepub fn initialize(
&mut self,
workspace_root: &Path,
initialization_options: Option<Value>,
) -> Result<InitializeResult, LspError>
pub fn initialize( &mut self, workspace_root: &Path, initialization_options: Option<Value>, ) -> Result<InitializeResult, LspError>
Send the initialize request and wait for response. Transition to Ready.
Sourcepub fn diagnostic_capabilities(&self) -> Option<&ServerDiagnosticCapabilities>
pub fn diagnostic_capabilities(&self) -> Option<&ServerDiagnosticCapabilities>
Diagnostic capabilities advertised by the server. Returns None until
initialize() has succeeded; returns Some with conservative defaults
(all false) when the server didn’t advertise diagnosticProvider.
Sourcepub fn supports_watched_files(&self) -> bool
pub fn supports_watched_files(&self) -> bool
Whether the server supports workspace/didChangeWatchedFiles.
Captured from the initialize response. Default false (conservative).
Sourcepub fn has_watched_file_registration(&self) -> bool
pub fn has_watched_file_registration(&self) -> bool
Whether this server currently has an active dynamic watched-file
registration. This, not the initialize-time capability shape, controls
whether workspace/didChangeWatchedFiles may be sent.
Sourcepub fn send_request<R>(
&mut self,
params: R::Params,
) -> Result<R::Result, LspError>
pub fn send_request<R>( &mut self, params: R::Params, ) -> Result<R::Result, LspError>
Send a request and wait for the response.
Sourcepub fn send_request_with_timeout<R>(
&mut self,
params: R::Params,
timeout: Duration,
) -> Result<R::Result, LspError>
pub fn send_request_with_timeout<R>( &mut self, params: R::Params, timeout: Duration, ) -> Result<R::Result, LspError>
Send a request and wait up to timeout for the response. If the local
deadline expires, remove the pending response handler and notify the
server with $/cancelRequest so it can stop work.
Sourcepub fn send_notification<N>(
&mut self,
params: N::Params,
) -> Result<(), LspError>
pub fn send_notification<N>( &mut self, params: N::Params, ) -> Result<(), LspError>
Send a notification (fire-and-forget).
Sourcepub fn shutdown(&mut self) -> Result<(), LspError>
pub fn shutdown(&mut self) -> Result<(), LspError>
Graceful shutdown: send shutdown request, then exit notification.
pub fn state(&self) -> ServerState
pub fn kind(&self) -> ServerKind
pub fn root(&self) -> &Path
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for LspClient
impl RefUnwindSafe for LspClient
impl Send for LspClient
impl Sync for LspClient
impl Unpin for LspClient
impl UnsafeUnpin for LspClient
impl UnwindSafe for LspClient
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
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 more