MingaEditor.FileTree.Diagnostics (Minga v0.1.0)

Copy Markdown View Source

Diagnostic status carried by a semantic file-tree row.

Rows keep diagnostic counts separate from dirty and git state so renderers can show each status independently without re-querying LSP or diagnostics state.

Summary

Functions

Returns the count for a severity.

Returns an empty diagnostic status.

Returns the highest severity represented by the counts.

Merges two diagnostic count sets.

Builds diagnostic status from a count tuple, map, keyword list, or existing struct.

Returns counts as the file-tree wire tuple.

Returns the total number of diagnostics.

Types

counts()

severity()

@type severity() :: :error | :warning | :info | :hint

t()

@type t() :: %MingaEditor.FileTree.Diagnostics{
  error_count: non_neg_integer(),
  hint_count: non_neg_integer(),
  info_count: non_neg_integer(),
  warning_count: non_neg_integer()
}

Functions

count_for(diagnostics, atom)

@spec count_for(t(), severity()) :: non_neg_integer()

Returns the count for a severity.

empty()

@spec empty() :: t()

Returns an empty diagnostic status.

highest_severity(diagnostics)

@spec highest_severity(t()) :: severity() | nil

Returns the highest severity represented by the counts.

merge(left, right)

@spec merge(
  t() | counts() | map() | keyword() | nil,
  t() | counts() | map() | keyword() | nil
) :: t()

Merges two diagnostic count sets.

new(diagnostics)

@spec new(t() | counts() | map() | keyword() | nil) :: t()

Builds diagnostic status from a count tuple, map, keyword list, or existing struct.

to_tuple(diagnostics)

@spec to_tuple(t()) :: counts()

Returns counts as the file-tree wire tuple.

total_count(diagnostics)

@spec total_count(t()) :: non_neg_integer()

Returns the total number of diagnostics.