Documentation
¶
Overview ¶
Package diagnostics defines the portable structured reporting model shared by Ferret runtimes and tooling.
Diagnostics contain universal source values and user-facing reporting details. Runtime and compiler implementations may retain richer internal error causes, but those implementation-specific causes are intentionally not part of this package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Annotation ¶
type Annotation struct {
Range source.Range `json:"range"`
Message string `json:"message"`
Primary bool `json:"primary"`
}
Annotation describes one highlighted source range associated with a diagnostic. Message may be empty when the range needs no separate label.
type Diagnostic ¶
type Diagnostic struct {
Kind Kind `json:"kind"`
Message string `json:"message"`
Source source.Source `json:"source"`
Annotations []Annotation `json:"annotations"`
Hint string `json:"hint"`
Note string `json:"note"`
}
Diagnostic describes one portable structured issue reported by a runtime or tool. It intentionally carries no implementation-specific error cause.
type Diagnostics ¶
type Diagnostics []Diagnostic
Diagnostics is an ordered portable collection of Diagnostic values. It is the error-bearing diagnostic type, including for failures with one item.
func (Diagnostics) Err ¶
func (d Diagnostics) Err() error
Err returns nil for an empty collection and the collection otherwise. The returned concrete error is Diagnostics, so wrapped diagnostic failures can be detected with errors.As into a Diagnostics value.
func (Diagnostics) Error ¶
func (d Diagnostics) Error() string
Error returns a concise summary derived from the collection.
type Kind ¶
type Kind string
Kind classifies a diagnostic. It is open so diagnostic producers can use domain-specific kinds without changing the universal API.