Expand description
Static recognition of the package/class authoring commands — the metadata a
.sty/.cls declares about itself. We read the declared facts only; nothing is
ever executed (AGENTS.md non-goals).
Three declarations are extracted, mirroring how \definecolor/\newglossaryentry
feed the SemanticModel:
\ProvidesPackage/\ProvidesClass/\ProvidesFileand the expl3\ProvidesExplPackage/Class/File— the package/class identity (name, date, version, description) →ProvidesDecl.\NeedsTeXFormat— the required format and optional release date →NeedsFormatDecl.\DeclareOption(and the starred default handler\DeclareOption*) — a declared option name →OptionDecl.
\ProcessOptions/\ExecuteOptions carry no extractable identity, so they get no
model entry — the LSP hover renders a static note for them.
The extraction helpers are pub and populate the SemanticModel
in the builder’s single CST walk; the LSP hover then matches the cursor against the
stored declarations by their control-word range, so extraction lives in one place.
The forthcoming package-aware diagnostics (TODO.md) consume the same model fields.
Structs§
- Needs
Format Decl - A
\NeedsTeXFormat{format}[date]declaration. - Option
Decl - A
\DeclareOption{name}{code}declaration, or the starred default handler\DeclareOption*{code}(withnameNone). - Provides
Decl - A
\ProvidesPackage/Class/File(or its expl3 variant) self-identification.
Enums§
- Provides
Form - The argument shape of a
\Provides…declaration: the LaTeX2e{name}[info]or the expl3{name}{date}{version}{description}. - Provides
Kind - Which of the three
\Provides…namespaces a declaration names.
Functions§
- needs_
format_ from_ command - Extract a
NeedsFormatDeclfrom a\NeedsTeXFormatCOMMANDnode. - option_
from_ command - Extract an
OptionDeclfrom a\DeclareOptionCOMMANDnode. The non-star form\DeclareOption{name}{code}reads the name from group 0; the starred default handler\DeclareOption*{code}(recognized by the*WORDthe parser folds into the invocation) recordsname: None. - provides_
from_ command - Extract a
ProvidesDeclfrom a\Provides…COMMANDnode, orNoneif the name group is a non-literal (nested macro) or the command is not a\Provides…. - provides_
kind - Whether
nameis a\Provides…declaration, and which namespace it names.