Skip to main content

DiagnosticKind

Enum DiagnosticKind 

Source
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.

Fields

§namespace: String
§

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.tabletable, doc.imageimage, 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

Source

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

Source§

fn clone(&self) -> DiagnosticKind

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DiagnosticKind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for DiagnosticKind

Source§

impl PartialEq for DiagnosticKind

Source§

fn eq(&self, other: &DiagnosticKind) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for DiagnosticKind

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more