pub struct MetadataManager { /* private fields */ }Expand description
High-performance metadata manager
Implementations§
Source§impl MetadataManager
impl MetadataManager
Sourcepub fn add_source(&self, source: MetadataSource)
pub fn add_source(&self, source: MetadataSource)
Add a metadata source
Sourcepub async fn fetch_all(&self) -> Result<FetchStats>
pub async fn fetch_all(&self) -> Result<FetchStats>
Fetch all metadata from configured sources
pub fn add_custom_functions_from_json(&self, json: &str) -> Result<usize>
pub fn remove_custom_functions(&self)
Sourcepub fn add_custom_functions_from_json_file(
&self,
path: impl AsRef<Path>,
) -> Result<usize>
pub fn add_custom_functions_from_json_file( &self, path: impl AsRef<Path>, ) -> Result<usize>
Load custom-functions JSON from a file on disk and register every entry.
The file must be an array of Function objects — the format produced by
[generate_custom_functions_json_to_file].
Sourcepub fn generate_custom_functions_json(
&self,
folder: impl AsRef<Path>,
) -> Result<String>
pub fn generate_custom_functions_json( &self, folder: impl AsRef<Path>, ) -> Result<String>
Scan folder (and all sub-folders) for *.js / *.ts files, extract
every custom function found via regex-based heuristics, and return a
pretty-printed JSON string of Function objects.
Intended as a one-time build / CLI step. Save the result to a file
and load it at LSP startup with [add_custom_functions_from_json_file]
— no source parsing is needed at runtime.
The output is directly consumable by [add_custom_functions_from_json].
Sourcepub fn generate_custom_functions_json_to_file(
&self,
folder: impl AsRef<Path>,
output_path: impl AsRef<Path>,
) -> Result<usize>
pub fn generate_custom_functions_json_to_file( &self, folder: impl AsRef<Path>, output_path: impl AsRef<Path>, ) -> Result<usize>
Like [generate_custom_functions_json] but writes the output directly to
output_path, creating parent directories as needed.
Returns the number of functions written.
Sourcepub fn get_exact(&self, name: &str) -> Option<Arc<Function>>
pub fn get_exact(&self, name: &str) -> Option<Arc<Function>>
Get function by exact name (case-insensitive)
Sourcepub fn get_prefix(&self, text: &str) -> Option<(String, Arc<Function>)>
pub fn get_prefix(&self, text: &str) -> Option<(String, Arc<Function>)>
Get the longest registered function name that is a prefix of text,
matching strictly from the start of text.
Sourcepub fn get(&self, name: &str) -> Option<Arc<Function>>
pub fn get(&self, name: &str) -> Option<Arc<Function>>
Get function: tries exact match first, then prefix match from the start.
Use get_exact when you need strict lookup (e.g. bracketed calls).
Sourcepub fn get_with_match(&self, name: &str) -> Option<(String, Arc<Function>)>
pub fn get_with_match(&self, name: &str) -> Option<(String, Arc<Function>)>
Get function with match info (matched key + Arc)
Sourcepub fn all_functions(&self) -> Vec<Arc<Function>>
pub fn all_functions(&self) -> Vec<Arc<Function>>
Get all functions
Sourcepub fn all_events(&self) -> Vec<Event>
pub fn all_events(&self) -> Vec<Event>
Get all events
Sourcepub fn function_count(&self) -> usize
pub fn function_count(&self) -> usize
Get function count
Sourcepub fn enum_count(&self) -> usize
pub fn enum_count(&self) -> usize
Get enum count
Sourcepub fn event_count(&self) -> usize
pub fn event_count(&self) -> usize
Get event count