Skip to main content

components_rs/components/
mod.rs

1//! Component extraction — the classes and parameters defined in `components.jsonld` files.
2//!
3//! # Two-phase loading
4//!
5//! [`registry::ComponentRegistry::register_available_modules`] uses a two-phase approach to
6//! handle cross-file merging correctly:
7//!
8//! 1. **Collect** — every reachable `components.jsonld` (following `rdfs:seeAlso` imports) is
9//!    parsed with [`rdf_parsers::jsonld::convert::parse_json`].  Nodes are merged into a flat
10//!    map keyed by their expanded IRI, and `@id` byte spans are harvested for goto-definition.
11//! 2. **Process** — `oo:Module` nodes are turned into [`types::CjsModule`] values; their inline
12//!    `oo:component` arrays become [`types::CjsComponent`] values with fully expanded IRIs.
13//!
14//! After loading, call [`registry::ComponentRegistry::finalize`] to walk each component's
15//! `rdfs:subClassOf` chain and merge inherited parameters in — without this step, completion
16//! only shows parameters declared directly on the component.
17//!
18//! # Key types for the LSP
19//!
20//! | Type | LSP feature |
21//! |------|-------------|
22//! | [`types::CjsComponent`] | `@type` completion, hover docs, goto-definition |
23//! | [`types::CjsParameter`] | key completion inside config objects, type hints |
24//! | [`types::CjsModule`] | module IRI completion in `@context` blocks |
25
26pub mod registry;
27pub mod types;