pub struct ComponentRegistry {
pub components: HashMap<String, CjsComponent>,
pub modules: HashMap<String, CjsModule>,
pub parameters: HashMap<String, (String, Range<usize>)>,
pub file_sources: HashMap<String, String>,
}Expand description
Registry of all discovered CJS components and modules.
Populated by register_available_modules
(two-phase: collect → merge → process) and then finalised with
finalize which resolves inherited parameters.
Primary LSP uses:
- Completion — iterate
componentsto offer@typevalues - Hover — look up a component by IRI to get
commentand parameter list - Goto-definition —
CjsComponent::iri_span+CjsModule::source_filegive the exact location in the components file
Fields§
§components: HashMap<String, CjsComponent>All components indexed by their fully expanded IRI.
modules: HashMap<String, CjsModule>All modules indexed by their fully expanded IRI.
parameters: HashMap<String, (String, Range<usize>)>All parameters indexed by their fully expanded IRI, pointing to
(source_file, iri_span) for goto-definition without searching every file.
file_sources: HashMap<String, String>Raw source text of every component file that was loaded, keyed by the
absolute file URL (same strings used in CjsComponent::source_file and
CjsModule::source_file). Used by the LSP to convert iri_span byte
offsets to LSP line/column positions without re-reading files from disk.
Implementations§
Source§impl ComponentRegistry
impl ComponentRegistry
pub fn new() -> Self
Sourcepub async fn register_available_modules(
&mut self,
fs: &dyn Fs,
state: &ModuleState,
) -> Result<()>
pub async fn register_available_modules( &mut self, fs: &dyn Fs, state: &ModuleState, ) -> Result<()>
Discover and register all modules reachable from the module state.
Phase 1 — recursively loads every components.jsonld file (following
rdfs:seeAlso imports), parses each with JsonLdVal to harvest @id
byte spans, then merges all nodes by IRI into all_nodes.
Phase 2 — walks all_nodes to find oo:Module nodes and extracts
their inline component definitions into CjsModule/CjsComponent.
Sourcepub fn finalize(&mut self)
pub fn finalize(&mut self)
Resolve inheritance: walk each component’s extends chain and merge in
any parameters not already declared on the component itself.
Must be called after all files have been loaded. Without this step, completion only shows parameters declared directly on a component and misses those inherited from abstract base classes.
Trait Implementations§
Source§impl Clone for ComponentRegistry
impl Clone for ComponentRegistry
Source§fn clone(&self) -> ComponentRegistry
fn clone(&self) -> ComponentRegistry
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more