pub trait Analyzer: Send {
// Required methods
fn find_references_for_symbol(
&self,
file_path: &Path,
line: usize,
character: usize,
project_root: &Path,
) -> Vec<PropagationResult>;
fn notify_did_open(&self, file_path: &Path, text: &str);
fn notify_did_change(&self, file_path: &Path, version: i32, text: &str);
fn notify_did_close(&self, file_path: &Path);
fn is_initialized(&self) -> bool;
}Expand description
Analyzer provides cross-file reference lookups via LSP or other language servers.
Each language server implementation (rust-analyzer, gopls, etc.) implements this trait, allowing scope-engine to query references without knowing the specific LSP server details.
All methods use &self to support interior mutability patterns (e.g. RefCell),
so implementations can be shared behind Mutex<dyn Analyzer + Send>.
Required Methods§
Sourcefn 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.
file_path is the absolute path to the file.
line is 1-based line number.
character is 0-based column offset.
project_root is the absolute path to the project root.
Sourcefn 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.
Sourcefn 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).
Sourcefn notify_did_close(&self, file_path: &Path)
fn notify_did_close(&self, file_path: &Path)
Notify the language server that a file was closed.
Sourcefn is_initialized(&self) -> bool
fn is_initialized(&self) -> bool
Whether the analyzer is available and initialized.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".