Skip to main content

MetadataManager

Struct MetadataManager 

Source
pub struct MetadataManager { /* private fields */ }
Expand description

High-performance metadata manager

Implementations§

Source§

impl MetadataManager

Source

pub fn new() -> Self

Create a new metadata manager

Source

pub fn add_source(&self, source: MetadataSource)

Add a metadata source

Source

pub async fn fetch_all(&self) -> Result<FetchStats>

Fetch all metadata from configured sources

Source

pub fn add_custom_functions_from_json(&self, json: &str) -> Result<usize>

Source

pub fn remove_custom_functions(&self)

Source

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].

Source

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].

Source

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.

Source

pub fn get_exact(&self, name: &str) -> Option<Arc<Function>>

Get function by exact name (case-insensitive)

Source

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.

Source

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).

Source

pub fn get_with_match(&self, name: &str) -> Option<(String, Arc<Function>)>

Get function with match info (matched key + Arc)

Source

pub fn get_many(&self, names: &[&str]) -> Vec<Option<Arc<Function>>>

Get multiple functions

Source

pub fn get_completions(&self, prefix: &str) -> Vec<Arc<Function>>

Get completions for a prefix

Source

pub fn all_functions(&self) -> Vec<Arc<Function>>

Get all functions

Source

pub fn get_enum(&self, name: &str) -> Option<Vec<String>>

Get enum values

Source

pub fn all_enums(&self) -> HashMap<String, Vec<String>>

Get all enums

Source

pub fn get_event(&self, name: &str) -> Option<Event>

Get event by name

Source

pub fn all_events(&self) -> Vec<Event>

Get all events

Source

pub fn function_count(&self) -> usize

Get function count

Source

pub fn enum_count(&self) -> usize

Get enum count

Source

pub fn event_count(&self) -> usize

Get event count

Source

pub fn clear(&self)

Clear all metadata

Source§

impl MetadataManager

Source

pub fn export_cache(&self) -> MetadataCache

Source

pub fn import_cache(&self, cache: MetadataCache) -> Result<()>

Source

pub fn cache_to_json(&self) -> Result<String>

Source

pub fn cache_from_json(&self, json: &str) -> Result<()>

Source§

impl MetadataManager

Source

pub fn save_cache_to_file(&self, path: impl AsRef<Path>) -> Result<()>

Source

pub fn load_cache_from_file(&self, path: impl AsRef<Path>) -> Result<()>

Trait Implementations§

Source§

impl Default for MetadataManager

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more