pub struct WorkspaceSymbolsProvider { /* private fields */ }Expand description
Workspace symbols provider for LSP workspace/symbol requests.
Maintains an index of all symbols across the workspace and provides search functionality with fuzzy matching support.
Implementations§
Source§impl WorkspaceSymbolsProvider
impl WorkspaceSymbolsProvider
Sourcepub fn new() -> WorkspaceSymbolsProvider
pub fn new() -> WorkspaceSymbolsProvider
Creates a new empty workspace symbols provider.
Sourcepub fn index_document(&mut self, uri: &str, ast: &Node, source: &str)
pub fn index_document(&mut self, uri: &str, ast: &Node, source: &str)
Indexes all symbols from a parsed document.
Extracts symbols from the AST and stores them for later search queries. Replaces any previously indexed symbols for the same URI.
Sourcepub fn remove_document(&mut self, uri: &str)
pub fn remove_document(&mut self, uri: &str)
Removes a document and its symbols from the index.
Called when a file is deleted or closed in the workspace.
Sourcepub fn get_all_symbols(&self) -> Vec<WorkspaceSymbol>
pub fn get_all_symbols(&self) -> Vec<WorkspaceSymbol>
Returns all indexed symbols as LSP WorkspaceSymbols.
Useful for bulk export or re-indexing operations. Note: Returned symbols have minimal location info (line 0, col 0).
Sourcepub fn search_with_candidates(
&self,
query: &str,
source_map: &HashMap<String, String>,
candidates: &[String],
) -> Vec<WorkspaceSymbol>
pub fn search_with_candidates( &self, query: &str, source_map: &HashMap<String, String>, candidates: &[String], ) -> Vec<WorkspaceSymbol>
Searches for symbols matching a query within a pre-filtered candidate set.
More efficient than search when the caller has already narrowed down
potential matches (e.g., from a global symbol index).
Results are sorted by relevance: exact matches first, then prefix matches, then alphabetically.
Sourcepub fn search(
&self,
query: &str,
source_map: &HashMap<String, String>,
) -> Vec<WorkspaceSymbol>
pub fn search( &self, query: &str, source_map: &HashMap<String, String>, ) -> Vec<WorkspaceSymbol>
Searches for symbols matching a query string.
Supports multiple match strategies:
- Exact match (case-insensitive)
- Prefix match
- Contains match
- Fuzzy/subsequence match
Results are sorted by relevance: exact matches first, then prefix matches, then alphabetically.