pub struct LspClient { /* private fields */ }Expand description
LSP Client for real-time diagnostics and symbol information
Implementations§
Source§impl LspClient
impl LspClient
Sourcepub async fn start(&mut self, workspace_root: &Path) -> Result<()>
pub async fn start(&mut self, workspace_root: &Path) -> Result<()>
Start the language server process
Sourcepub async fn get_diagnostics(&self, path: &str) -> Vec<Diagnostic>
pub async fn get_diagnostics(&self, path: &str) -> Vec<Diagnostic>
Get diagnostics for a file Get diagnostics for a file
Sourcepub fn calculate_syntactic_energy(diagnostics: &[Diagnostic]) -> f32
pub fn calculate_syntactic_energy(diagnostics: &[Diagnostic]) -> f32
Calculate syntactic energy from diagnostics
V_syn = sum(severity_weight * count) Error = 1.0, Warning = 0.1, Hint = 0.01
Sourcepub async fn did_open(&mut self, path: &Path, content: &str) -> Result<()>
pub async fn did_open(&mut self, path: &Path, content: &str) -> Result<()>
Notify language server that a file was opened
Sourcepub async fn did_change(
&mut self,
path: &Path,
content: &str,
version: i32,
) -> Result<()>
pub async fn did_change( &mut self, path: &Path, content: &str, version: i32, ) -> Result<()>
Notify language server that a file changed
Sourcepub async fn goto_definition(
&mut self,
path: &Path,
line: u32,
character: u32,
) -> Option<Vec<Location>>
pub async fn goto_definition( &mut self, path: &Path, line: u32, character: u32, ) -> Option<Vec<Location>>
Go to definition of symbol at position Uses textDocument/definition LSP request
Sourcepub async fn find_references(
&mut self,
path: &Path,
line: u32,
character: u32,
include_declaration: bool,
) -> Vec<Location>
pub async fn find_references( &mut self, path: &Path, line: u32, character: u32, include_declaration: bool, ) -> Vec<Location>
Find all references to symbol at position Uses textDocument/references LSP request
Sourcepub async fn hover(
&mut self,
path: &Path,
line: u32,
character: u32,
) -> Option<String>
pub async fn hover( &mut self, path: &Path, line: u32, character: u32, ) -> Option<String>
Get hover information (type, docs) at position Uses textDocument/hover LSP request
Sourcepub async fn get_symbols(&mut self, path: &Path) -> Vec<DocumentSymbolInfo>
pub async fn get_symbols(&mut self, path: &Path) -> Vec<DocumentSymbolInfo>
Get all symbols in a document Uses textDocument/documentSymbol LSP request
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 !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