Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[coq] [loader] Don't swallow plugin loading errors. #557

Merged
merged 1 commit into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
`--ocamlpath`, `-Q` and `-R` arguments (@ejgallego, #555)
- Describe findlib status in `Workspace.describe`, which is printed
in the output windows (@ejgallego, #556)
- `coq-lsp` plugin loader will now be strict in case of a plugin
failure, the previous loose behavior was more convenient for the
early releases, but it doesn't make sense now and made things
pretty hard to debug on the Windows installer (@ejgallego, #557)

# coq-lsp 0.1.7: Just-in-time
-----------------------------
Expand Down
11 changes: 7 additions & 4 deletions coq/loader.ml
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,12 @@ let map_serlib fl_pkg =
check_package_exists serlib_name
else None

(* We are more liberal in the case a SerAPI plugin is not availabe, as the
fallbacks are "safe", tho will yield way worse incremental behavior for
expressions defined by the plugin *)
(* We used to be liberal here in the case a SerAPI plugin was not available.
This proved to be a bad choice as Coq got confused when plugin loading
failed. Par-contre, we now need to make the list in `map_serlib` open, so
plugins can register whether they support serialization. I'm afraid that'll
have to happen via the finlib database as we cannot load anticipatedly a
plugin that may not exist. *)
let safe_loader loader fl_pkg =
try loader [fl_pkg]
with
Expand All @@ -74,7 +77,7 @@ let safe_loader loader fl_pkg =
Feedback.msg_warning
Pp.(str "Loading findlib plugin: " ++ str fl_pkg
++ str "failed" ++ fnl () ++ exn_msg);
()
Exninfo.iraise iexn

let plugin_handler user_loader =
let loader = Option.default (Fl_dynload.load_packages ~debug:false) user_loader in
Expand Down