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>,
) -> Result<Self>
pub fn spawn( kind: ServerKind, root: PathBuf, binary: &Path, args: &[String], env: &HashMap<String, String>, event_tx: Sender<LspEvent>, ) -> Result<Self>
Spawn a new language server process and start the background reader thread.
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 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_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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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