pub struct SemanticModel { /* private fields */ }Expand description
A file’s label definitions and reference uses.
Eq is load-bearing: the semantic_model salsa query is not no_eq
(unlike parsed_document), so an edit leaving this model unchanged backdates
and downstream queries are not re-run.
Implementations§
Source§impl SemanticModel
impl SemanticModel
Sourcepub fn build(root: &SyntaxNode) -> Self
pub fn build(root: &SyntaxNode) -> Self
Build the model from a parse tree root.
pub fn labels(&self) -> &[LabelDef]
pub fn label(&self, id: LabelId) -> &LabelDef
pub fn refs(&self) -> &[LabelRef]
Sourcepub fn citations(&self) -> &[CitationRef]
pub fn citations(&self) -> &[CitationRef]
The citation uses (\cite/\parencite/… keys) in this file.
Sourcepub fn glossary_defs(&self) -> &[GlossaryDef]
pub fn glossary_defs(&self) -> &[GlossaryDef]
The glossary/acronym key definitions (\newglossaryentry/\newacronym/…)
in this file.
Sourcepub fn color_defs(&self) -> &[ColorDef]
pub fn color_defs(&self) -> &[ColorDef]
The color-name definitions (\definecolor/\providecolor/\colorlet) in
this file, offered by color-name completion.
Sourcepub fn has_wildcard_nocite(&self) -> bool
pub fn has_wildcard_nocite(&self) -> bool
Whether the file contains a \nocite{*} wildcard.
Sourcepub fn provides(&self) -> Option<&ProvidesDecl>
pub fn provides(&self) -> Option<&ProvidesDecl>
The file’s \ProvidesPackage/\ProvidesClass/\ProvidesFile self-identification.
Sourcepub fn needs_format(&self) -> Option<&NeedsFormatDecl>
pub fn needs_format(&self) -> Option<&NeedsFormatDecl>
The file’s \NeedsTeXFormat declaration.
Sourcepub fn options(&self) -> &[OptionDecl]
pub fn options(&self) -> &[OptionDecl]
The file’s \DeclareOption declarations.
pub fn reference(&self, id: RefId) -> &LabelRef
Sourcepub fn unreferenced_labels(&self) -> impl Iterator<Item = LabelId> + '_
pub fn unreferenced_labels(&self) -> impl Iterator<Item = LabelId> + '_
Label definitions never referenced within this file.
A per-file fact, not a lint signal: a label referenced only from
another file looks unreferenced here. The cross-file unreferenced-label
lint instead builds on the project-level
project::resolved_labels (as undefined-ref does for refs),
firing only in a closed, rooted namespace so it never false-positives on
labels referenced from outside the analyzed set.
Sourcepub fn unresolved_refs(&self) -> impl Iterator<Item = RefId> + '_
pub fn unresolved_refs(&self) -> impl Iterator<Item = RefId> + '_
References whose key matches no \label in this file.
A per-file fact, not a lint signal: the key may be defined in an
included file. The undefined-ref lint instead consults the cross-file
project::resolved_labels, firing only in a closed, rooted
document namespace.