pub struct LspClient { /* private fields */ }Expand description
A running language server client.
Implementations§
Source§impl LspClient
impl LspClient
Sourcepub async fn start(
config: &LspServerConfig,
project_root: &Path,
language_id: &str,
) -> Result<Self>
pub async fn start( config: &LspServerConfig, project_root: &Path, language_id: &str, ) -> Result<Self>
Spawn a language server and perform the initialize handshake.
Sourcepub async fn diagnostics(&self, path: &Path) -> Vec<Diagnostic>
pub async fn diagnostics(&self, path: &Path) -> Vec<Diagnostic>
Return cached diagnostics for a file.
Sourcepub async fn all_diagnostics(&self) -> Vec<Diagnostic>
pub async fn all_diagnostics(&self) -> Vec<Diagnostic>
Return all cached diagnostics across all files.
Sourcepub async fn did_open(
&self,
path: &Path,
content: &str,
language_id: &str,
) -> Result<()>
pub async fn did_open( &self, path: &Path, content: &str, language_id: &str, ) -> Result<()>
Notify the server that a file was opened.
Sourcepub async fn did_change(
&self,
path: &Path,
content: &str,
version: i32,
) -> Result<()>
pub async fn did_change( &self, path: &Path, content: &str, version: i32, ) -> Result<()>
Notify the server that a file changed.
Sourcepub async fn did_close(&self, path: &Path) -> Result<()>
pub async fn did_close(&self, path: &Path) -> Result<()>
Notify the server that a file was closed.
Sourcepub async fn sync_document(
&self,
path: &Path,
content: &str,
language_id: &str,
) -> Result<()>
pub async fn sync_document( &self, path: &Path, content: &str, language_id: &str, ) -> Result<()>
Sync a document with the server, using didOpen for first open and didChange for updates. This is the preferred method for notifying the server about file changes.
Sourcepub async fn close_document(&self, path: &Path) -> Result<()>
pub async fn close_document(&self, path: &Path) -> Result<()>
Close a document, sending didClose and removing from tracking.
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