bolt/lsp/report.bend checks
raw source on the hub · import 0x729eecea86ea5a2cdba3a2856a313bca/bolt/lsp/report.bend as Report
lsp/report: the checker's text, as diagnostics. bend prints an error as
Error: (or Error: a one-line message)
- expected : .. the message lines, then Context: and its lines
Location: name the def; ../mod.name when it sits in an import
4>| x the source excerpt; >| marks the line, 1-based
There are no columns, so a diagnostic covers its whole line. An error in an
import cannot be placed in this file: it lands on line 0, naming its home.
1 import
import Base
Types
type Diag source · line 11 · raw
Data
line is 0-based, as LSP counts
Diag@line:U32 -> @msg:String -> Diag
type Line source · line 15 · raw
Data
a line of the checker's report, by what it starts with
KError@rest:String -> Line
KLocation@place:String -> Line
KOther@text:String -> Line
type St source · line 21 · raw
Data
msg and out are reversed
St@seen:Bool -> @located:Bool -> @msg:List<&2, String> -> @line:U32 -> @place:String -> @out:List<&2, Diag> -> St
Definitions
def classify source · line 25 · raw
@+s:String -> Line
a report line's kind
def not_space source · line 30 · raw
@c:Char -> Bool
not whitespace?
def strip source · line 34 · raw
@s:String -> String
every whitespace char dropped
def lstrip.go source · line 38 · raw
@cs:List<&2, Char> -> List<&2, Char>
drops leading spaces
def lstrip source · line 46 · raw
@s:String -> String
leading whitespace dropped
def marker.of source · line 51 · raw
@parts:List<&2, String> -> Maybe<&2, U32>
12>| code marks line 12: the text before the first '>' is the number, and
the text after it starts with '|' (a '>' later in the code changes nothing)
def marker source · line 59 · raw
@s:String -> Maybe<&2, U32>
the line number a source line of the report carries (9>|), when it does
def clean source · line 63 · raw
@+s:String -> String
a message line, without its -
def push source · line 67 · raw
@+s:String -> @+msg:List<&2, String> -> List<&2, String>
a non-empty line onto the message
def message source · line 72 · raw
@+place:String -> @msg:List<&2, String> -> String
the message lines (reversed) as text, headed by where it is when that is another file
def line_of source · line 77 · raw
@place:String -> @+line:U32 -> U32
the 0-based line for a diagnostic: line 0 for an error in an import
def flush source · line 81 · raw
@seen:Bool -> @msg:List<&2, String> -> @+line:U32 -> @+place:String -> @+out:List<&2, Diag> -> List<&2, Diag>
the error so far becomes a diagnostic; "no main to run" is a library, not an error
def step.go source · line 86 · raw
@k:Line -> @located:Bool -> @seen:Bool -> @msg:List<&2, String> -> @+line:U32 -> @place:String -> @out:List<&2, Diag> -> St
def step source · line 101 · raw
@s:String -> @st:St -> St
one report line
def run source · line 106 · raw
@lines:List<&2, String> -> @st:St -> St
every report line, in order
def finish source · line 114 · raw
@st:St -> List<&2, Diag>
the diagnostics once the lines are over, a pending one flushed
def parse source · line 119 · raw
@text:String -> List<&2, Diag>
the checker's text as diagnostics