Skip to content

Commit

Permalink
Capture the correct loc for when an import fails.
Browse files Browse the repository at this point in the history
Explicit the corresponding errors and get the loc from
the qualid, which solves a silly display bug.
  • Loading branch information
rtetley committed Feb 20, 2024
1 parent 50231cb commit 78f3b5e
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions language-server/dm/document.ml
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,16 @@ let rec parse_more synterp_state stream raw parsed errors =
parse_more synterp_state stream raw parsed errors
with exn ->
let e, info = Exninfo.capture exn in
let loc = Loc.get_loc @@ info in
handle_parse_error start (loc, Pp.string_of_ppcmds @@ CErrors.iprint_no_report (e,info))
match e with
| Synterp.UnmappedLibrary (_, qid) ->
let loc = qid.loc in
handle_parse_error start (loc, Pp.string_of_ppcmds @@ CErrors.iprint_no_report (e,info))
| Synterp.NotFoundLibrary (_, qid) ->
let loc = qid.loc in
handle_parse_error start (loc, Pp.string_of_ppcmds @@ CErrors.iprint_no_report (e,info))
| _ ->
let loc = Loc.get_loc @@ info in
handle_parse_error start (loc, Pp.string_of_ppcmds @@ CErrors.iprint_no_report (e,info))
end
| exception (E msg as exn) ->
let loc = Loc.get_loc @@ Exninfo.info exn in
Expand Down

0 comments on commit 78f3b5e

Please sign in to comment.