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

refactor: fix against newer versions of dune #1200

Merged
Merged
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
12 changes: 8 additions & 4 deletions ocaml-lsp-server/src/progress.ml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ let build_progress t (progress : Drpc.Progress.t) =
| Failed -> end_build t ~message:"Build failed"
| Interrupted -> end_build t ~message:"Build interrupted"
| Waiting -> end_build t ~message:"Waiting for changes"
| In_progress { complete; remaining } ->
| In_progress progress ->
let* token =
match token with
| Some token -> Fiber.return token
Expand All @@ -75,19 +75,23 @@ let build_progress t (progress : Drpc.Progress.t) =
build. *)
start_build t
in
let total = complete + remaining in
let total = progress.complete + progress.remaining in
(* The percentage is useless as it isn't monotinically increasing as
the spec requires, but it's the best we can do. *)
let percentage =
let fraction = float_of_int complete /. float_of_int total in
let fraction =
float_of_int progress.complete /. float_of_int total
in
int_of_float (fraction *. 100.)
in
report_progress
(ProgressParams.create
~token
~value:
(Progress.Report
(let message = sprintf "Building [%d/%d]" complete total in
(let message =
sprintf "Building [%d/%d]" progress.complete total
in
WorkDoneProgressReport.create ~percentage ~message ())))))

let should_report_build_progress = function
Expand Down