module Types = Linol_lsp.Types (** Generate a diagnostic from the report *) let position : Lexing.position -> Types.Position.t = fun pos -> { character = pos.Lexing.pos_cnum - pos.Lexing.pos_bol; line = pos.Lexing.pos_lnum - 1; } let build : Qsp_syntax.Report.t -> Types.Diagnostic.t = fun { level; loc; message } -> let severity = match level with | Error -> Types.DiagnosticSeverity.Error | Warn -> Types.DiagnosticSeverity.Warning | Debug -> Types.DiagnosticSeverity.Hint in let start = position (fst loc) and end_ = position (snd loc) in let range = Types.Range.{ start; end_ } in let message = `String message in Types.Diagnostic.create ~range ~message ~severity ()