pub struct LspClient { /* private fields */ }Expand description
Manages an LSP language server subprocess and communicates via JSON-RPC 2.0.
Uses RefCell<LspClientInner> for interior mutability so that the
Analyzer trait’s &self methods can perform LSP I/O without needing
&mut self.
Lifecycle:
new()— locate or download the server binary, spawn it, perform LSPinitialize.notify_did_open()/notify_did_change()/notify_did_close()— keep LSP in sync.find_references_for_symbol()— query cross-file references viatextDocument/references.Drop— sendshutdown, then kill the subprocess.
Implementations§
Source§impl LspClient
impl LspClient
pub fn new(project_root: &Path, config: &dyn LspServerConfig) -> Self
pub fn notify_did_open(&self, file_path: &Path, text: &str)
pub fn notify_did_change(&self, file_path: &Path, version: i32, text: &str)
pub fn notify_did_close(&self, file_path: &Path)
pub fn find_references_for_symbol( &self, file_path: &Path, line: usize, character: usize, project_root: &Path, ) -> Vec<PropagationResult>
Trait Implementations§
Source§impl Analyzer for LspClient
impl Analyzer for LspClient
Source§fn find_references_for_symbol(
&self,
file_path: &Path,
line: usize,
character: usize,
project_root: &Path,
) -> Vec<PropagationResult>
fn find_references_for_symbol( &self, file_path: &Path, line: usize, character: usize, project_root: &Path, ) -> Vec<PropagationResult>
Find all references to the symbol at the given position in the file. Read more
Source§fn notify_did_open(&self, file_path: &Path, text: &str)
fn notify_did_open(&self, file_path: &Path, text: &str)
Notify the language server that a file was opened.
Source§fn notify_did_change(&self, file_path: &Path, version: i32, text: &str)
fn notify_did_change(&self, file_path: &Path, version: i32, text: &str)
Notify the language server that a file was modified (full sync).
Source§fn notify_did_close(&self, file_path: &Path)
fn notify_did_close(&self, file_path: &Path)
Notify the language server that a file was closed.
Source§fn is_initialized(&self) -> bool
fn is_initialized(&self) -> bool
Whether the analyzer is available and initialized.
Auto Trait Implementations§
impl !Freeze for LspClient
impl !RefUnwindSafe for LspClient
impl !Sync for LspClient
impl !UnwindSafe for LspClient
impl Send for LspClient
impl Unpin for LspClient
impl UnsafeUnpin 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