pub enum DiagnosticKind {
Show 14 variants
MissingFootnoteDefinition,
UnusedFootnoteDefinition,
TableInconsistentColumns,
SchemaValidation(SchemaValidationKind),
Handler {
namespace: String,
code: Option<String>,
},
ForbiddenLabelPrefix,
UnknownLexCanonical,
UnclosedAnnotation,
MissingSessionTarget,
MissingDefinitionTarget,
MissingAnnotationTarget,
MissingCitationTarget,
MalformedUrl,
MissingFileTarget,
}Variants§
MissingFootnoteDefinition
UnusedFootnoteDefinition
TableInconsistentColumns
SchemaValidation(SchemaValidationKind)
A label invocation failed schema pre-validation before the handler was dispatched. The variant carries which of the pre-validation checks tripped.
Handler
A diagnostic emitted by a registered extension handler. The
namespace field is the namespace name (the part before the
first ., e.g., "acme" for label "acme.task") — lex-lsp
surfaces it as the diagnostic source: "lex:<namespace>" so
editors can filter by extension.
code carries the bare leaf the handler supplied (the
code field on lex_extension::Diagnostic), not the wire
form. The analyser glues on the namespace prefix in
DiagnosticKind::code to produce the wire shape per spec §9
(<namespace>.<leaf>, e.g. "acme.foo"; or the per-namespace
fallback "acme.diagnostic" when the handler set None).
Passing an already-prefixed value here would produce a
double-prefixed wire code ("acme.acme.foo") — handlers should
supply just the leaf.
ForbiddenLabelPrefix
A label uses the reserved doc.* prefix (forbidden under
comms/specs/general.lex §4.1). PR 4 of #584 emits this when
permissive-mode parse lets the label flow through; the LSP
then offers a quickfix to rewrite to the blessed shortcut
(doc.table → table, doc.image → image, etc.).
UnknownLexCanonical
A lex.* literal that doesn’t match any registered canonical
in lex_core::lex::builtins::CANONICAL_LABELS. Typically a
typo (lex.fooar) or a label authored against a future
version of the core schemas.
UnclosedAnnotation
A paragraph line that looks like an annotation header (:: label)
but has no closing ::. There is no “open form” — such a line is
kept as paragraph text rather than dropped (lex#700) — so this
warns the author that what looks like metadata is being treated as
content. The fix is to close the marker: :: label ::.
MissingSessionTarget
A session reference ([#2.1]) whose identifier matches no session
in the merged document. Emitted only by the opt-in
analyze_references pass (check --references), never by the
always-on analyser.
MissingDefinitionTarget
A definition reference ([Title]) whose subject matches no
definition in the merged document. Opt-in (check --references).
MissingAnnotationTarget
An annotation reference ([::label]) whose label matches no
annotation in the merged document. Opt-in (check --references).
MissingCitationTarget
A citation reference ([@key]) whose key matches no annotation
label or definition subject in the merged document. Opt-in
(check --references).
MalformedUrl
A URL reference ([http://…], [https://…], [mailto:…]) that
is not well-formed (embedded space, empty host, otherwise
unparseable).
Opt-in (check --references); a pure parse check — network
reachability is out of scope. Emitted by analyze_references.
MissingFileTarget
A file-path reference — an inline ReferenceType::File
([./x.txt], [../y], [/abs]) or a verbatim block’s src=
parameter — that points at no file on disk, or whose target escapes
the resolution root / is a platform-absolute path. Opt-in:
emitted only by check --references (the existence check is
IO-bearing, so it runs in the CLI seam, not the pure analyser).
lex.include src= is excluded — its path is validated by the
base command via include expansion.
Implementations§
Source§impl DiagnosticKind
impl DiagnosticKind
Sourcepub fn code(&self) -> Cow<'static, str>
pub fn code(&self) -> Cow<'static, str>
The on-the-wire code for this diagnostic kind. The same value
travels in lsp_types::Diagnostic.code and is the key the
[diagnostics.rules] block in .lex.toml matches against
(see DiagnosticsRulesConfig::lookup_by_code).
For the Handler variant — extension-emitted diagnostics —
this returns the namespace-prefixed code: "acme.foo" for
Handler { namespace: "acme", code: Some("foo") }, or
"acme.diagnostic" when the handler omitted a code. The
namespace prefix is what [diagnostics.rules] keys match
against (spec §9), and the per-namespace .diagnostic fallback
gives users one knob per namespace for code-less handler
diagnostics rather than a single global "handler.diagnostic".
Returns Cow<'static, str> so built-in variants borrow a
static string (no allocation) while the Handler variant owns
the format!-produced result. apply_rules runs on every
document change in the LSP, so avoiding per-built-in allocations
matters.
Trait Implementations§
Source§impl Clone for DiagnosticKind
impl Clone for DiagnosticKind
Source§fn clone(&self) -> DiagnosticKind
fn clone(&self) -> DiagnosticKind
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DiagnosticKind
impl Debug for DiagnosticKind
impl Eq for DiagnosticKind
Source§impl PartialEq for DiagnosticKind
impl PartialEq for DiagnosticKind
Source§fn eq(&self, other: &DiagnosticKind) -> bool
fn eq(&self, other: &DiagnosticKind) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for DiagnosticKind
Auto Trait Implementations§
impl Freeze for DiagnosticKind
impl RefUnwindSafe for DiagnosticKind
impl Send for DiagnosticKind
impl Sync for DiagnosticKind
impl Unpin for DiagnosticKind
impl UnsafeUnpin for DiagnosticKind
impl UnwindSafe for DiagnosticKind
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more