Skip to content

Commit

Permalink
fix: allow disabling dune integration
Browse files Browse the repository at this point in the history
Signed-off-by: Rudi Grinberg <[email protected]>
  • Loading branch information
rgrinberg committed Nov 21, 2021
1 parent 584808a commit f3b9c72
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion ocaml-lsp-server/src/dune.ml
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,17 @@ let create workspaces (client_capabilities : ClientCapabilities.t) diagnostics
; workspaces
})

let enabled = false

let create_disabled () = ref Closed

let create workspaces (client_capabilities : ClientCapabilities.t) diagnostics
progress ~log =
if enabled then
create workspaces client_capabilities diagnostics progress ~log
else
Fiber.return (create_disabled ())

let run_loop t =
Fiber.repeat_while ~init:() ~f:(fun () ->
match !t with
Expand All @@ -598,7 +609,7 @@ let run_loop t =
let run t : unit Fiber.t =
Fiber.of_thunk (fun () ->
match !t with
| Closed -> Code_error.raise "dune already closed" []
| Closed -> Fiber.return ()
| Active active ->
Fiber.fork_and_join_unit
(fun () -> run_loop t)
Expand Down

0 comments on commit f3b9c72

Please sign in to comment.