Skip to content

Commit

Permalink
server: more compact string representation for CN errors
Browse files Browse the repository at this point in the history
  • Loading branch information
samcowger committed Jan 28, 2025
1 parent b73210b commit 745ad30
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions cn-lsp/lib/lspCn.ml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,10 @@ module Error = struct
let to_string (err : t) : string =
let report = Cn.TypeErrors.pp_message err.msg in
let short = Cn.Pp.plain report.short in
let desc = Option.value (Option.map report.descr ~f:Cn.Pp.plain) ~default:"<none>" in
"CN Error: loc = "
^ Cn.Locations.to_string err.loc
^ ", short = "
^ short
^ ", desc = "
^ desc
let loc = Cn.Locations.to_string err.loc in
match report.descr with
| None -> Printf.sprintf "%s: %s" loc short
| Some desc -> Printf.sprintf "%s: %s (%s)" loc short (Cn.Pp.plain desc)
;;

let to_diagnostic (err : t) : (Uri.t * Diagnostic.t) option =
Expand Down

0 comments on commit 745ad30

Please sign in to comment.