A single diagnostic — an error, warning, info, or hint tied to a location.
Source-agnostic: LSP servers, external linters, compilers, and test runners
all produce the same struct. The source field identifies the producer
(e.g., "lexical", "mix_compile").
Summary
Types
A source location range (zero-indexed lines and byte columns).
Severity level, ordered from most to least severe.
A diagnostic entry.
Functions
Compares two severities. Returns :lt, :eq, or :gt.
Returns the more severe of two severities.
Sorts diagnostics by line, then column, then severity (most severe first).
Types
@type range() :: %{ start_line: non_neg_integer(), start_col: non_neg_integer(), end_line: non_neg_integer(), end_col: non_neg_integer() }
A source location range (zero-indexed lines and byte columns).
@type severity() :: :error | :warning | :info | :hint
Severity level, ordered from most to least severe.
@type t() :: %Minga.Diagnostics.Diagnostic{ code: String.t() | integer() | nil, message: String.t(), range: range(), severity: severity(), source: String.t() | nil }
A diagnostic entry.
Functions
Compares two severities. Returns :lt, :eq, or :gt.
:error is the most severe (lowest rank).
Examples
iex> Minga.Diagnostics.Diagnostic.compare_severity(:error, :warning)
:lt
iex> Minga.Diagnostics.Diagnostic.compare_severity(:hint, :error)
:gt
Returns the more severe of two severities.
Examples
iex> Minga.Diagnostics.Diagnostic.more_severe(:warning, :error)
:error
iex> Minga.Diagnostics.Diagnostic.more_severe(:info, :hint)
:info
Sorts diagnostics by line, then column, then severity (most severe first).