Vixen
dd8b0a81
csharp
public readonly record struct SelectorDiagnostic

Why a selector could not be compiled.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

⚠ is the fragment, and on its own it does not say which rule to go and fix. A refusal names what the compiler choked on — ::before, :has(…), a combinator — because that is what it was looking at when it stopped. That is the right thing to report and the wrong thing to report alone: a sheet with two ::before rules produces two lines differing only in a reason, and neither names a rule. There are no line numbers to fall back on, because ExCSS does not carry them through to the nodes this walks.

⚠ It began mattering when the drain landed. Until then these went into a List<SelectorDiagnostic> behind a public property that nothing outside this assembly's tests read, and a test knows which rule it wrote. They now reach the editor's Console panel, the log overlay and the crash dump, where the reader is a person looking at a stylesheet they did not necessarily write.

Null rather than a copy of when the two would be the same, so that the sink can tell "the rule is the fragment" from "the rule is elsewhere" and log the shorter message for the first. See Where.

Fields and properties (5)

  • public string Text

    The fragment that stopped it, as it was written.

  • public string Reason

    What stopped it.

  • public string? Rule

    The enclosing rule the fragment was written in, or when is already the whole of it. Read through Where.

  • public string Where

    The rule to go and fix: Rule when there is one, else Text.

  • public bool NamesAnEnclosingRule

    Whether Rule says something Text does not.

Methods (1)

  • public SelectorDiagnostic(string Text, string Reason, string? Rule = null)

    Why a selector could not be compiled.

Used by (12)

  • ContainerQueryTestsVixen.Ui.Styling.Tests
  • DrawListBuilderVixen.Ui
  • EmitterTestsVixen.Ui.Markup.Tests
  • GridFromCssTestsVixen.Ui.Tests
  • LayoutStyleBuilderVixen.Ui
  • SelectorCompilerVixen.Ui.Styling
  • SelectorMatchingTestsVixen.Ui.Styling.Tests
  • SelectorQueryVixen.Ui.Testing
  • StyleDiagnosticDrainTestsVixen.Ui.Tests
  • StyleSheetLoaderVixen.Ui.Styling
  • StyleSheetLoadingTestsVixen.Ui.Styling.Tests
  • UiDocumentVixen.Ui