Structured diagnostic emitted by Vize.
to_code_diagnostic/2 converts one to Elixir's Code.diagnostic/1 shape,
which editors, Mix.Task.Compiler, and tools such as OXC and Volt share.
Summary
Functions
Shifts a {line, column} position in a source Vize was given to the file it
came from, whose content starts at origin.
Converts a diagnostic to Elixir's Code.diagnostic/1 shape.
Types
@type input() :: %{ optional(:code) => atom() | String.t() | nil, :message => String.t(), optional(:location) => Vize.SourceRange.input() | Vize.SourceRange.t() | nil, optional(:loc) => Vize.SourceRange.input() | Vize.SourceRange.t() | nil, optional(:start) => Vize.SourceLocation.input() | nil, optional(:end) => Vize.SourceLocation.input() | nil, optional(:severity) => :error | :warning, optional(:recoverable?) => boolean(), optional(:recoverable) => boolean() }
@type t() :: %Vize.Diagnostic{ code: atom() | String.t() | nil, location: Vize.SourceRange.t() | nil, message: String.t(), recoverable?: boolean(), severity: :error | :warning }
Functions
@spec shift({pos_integer(), pos_integer()}, {pos_integer(), pos_integer()}) :: {pos_integer(), pos_integer()}
Shifts a {line, column} position in a source Vize was given to the file it
came from, whose content starts at origin.
@spec to_code_diagnostic( t(), keyword() ) :: Code.diagnostic(:error | :warning)
Converts a diagnostic to Elixir's Code.diagnostic/1 shape.
Options
:file— the file the diagnostic belongs to:origin—{line, column}where the source Vize was given starts in that file, such as a<template>block's content in an SFC, so positions point into the file (default:{1, 1})