@@ -144,21 +144,17 @@ let check_ocaml_lsp_available (sandbox : Sandbox.t) =
144144 let + dune_lsp_present = Dune. is_ocamllsp_present dune in
145145 if dune_lsp_present
146146 then Ok ()
147- else Error " ` ocaml-lsp-server` is not installed in the current dune sandbox."
147+ else Error " \" ocaml-lsp-server\" is not installed in the current dune sandbox."
148148 | _ ->
149149 let ocaml_lsp_version sandbox =
150150 Sandbox. get_command sandbox " ocamllsp" [ " --version" ] `Tool
151151 in
152- let cwd =
153- match Workspace. workspaceFolders () with
154- | [ cwd ] -> Some (cwd |> WorkspaceFolder. uri |> Uri. fsPath |> Path. of_string)
155- | _ -> None
156- in
152+ let cwd = Sandbox. workspace_root () in
157153 Cmd. output ?cwd (ocaml_lsp_version sandbox)
158154 |> Promise.Result. fold
159155 ~ok: (fun (_ : string ) -> () )
160156 ~error: (fun (_ : string ) ->
161- " Sandbox initialization failed: ` ocaml-lsp-server` is not installed in the \
157+ " Sandbox initialization failed: \" ocaml-lsp-server\" is not installed in the \
162158 current sandbox." )
163159;;
164160
@@ -216,8 +212,8 @@ end = struct
216212 let * selection =
217213 Window. showInformationMessage
218214 ~message:
219- " Failed to start the language server. ` ocaml-lsp-server` is not installed in \
220- the current sandbox."
215+ " Failed to start the language server. \" ocaml-lsp-server\" is not installed \
216+ in the current sandbox."
221217 ~choices:
222218 [ install_lsp_text, `Install_lsp ; select_different_sandbox, `Select_sandbox ]
223219 ()
@@ -282,7 +278,7 @@ end = struct
282278 | Error s ->
283279 show_message
284280 `Error
285- " An error occurred starting the language server ` ocamllsp` . %s"
281+ " An error occurred starting the language server \" ocamllsp\" . %s"
286282 s)
287283 | Error _ -> suggest_or_install_ocaml_lsp_server t
288284 ;;
@@ -427,7 +423,10 @@ let close_repl t = t.repl <- None
427423let update_ocaml_info t =
428424 let open Promise.Syntax in
429425 let + ocaml_version =
430- let + r = Sandbox. get_command t.sandbox " ocamlc" [ " --version" ] `Exec |> Cmd. output in
426+ let cwd = Sandbox. workspace_root () in
427+ let + r =
428+ Sandbox. get_command t.sandbox " ocamlc" [ " -version" ] `Exec |> Cmd. output ?cwd
429+ in
431430 match r with
432431 | Ok v ->
433432 Ocaml_version. of_string v
@@ -436,7 +435,7 @@ let update_ocaml_info t =
436435 log_chan
437436 ~section: " Ocaml.version_semver"
438437 `Warn
439- " Error running ` ocamlc -- version` : %s"
438+ " Error running \" ocamlc -version\" : %s"
440439 e;
441440 Error `Ocamlc_missing
442441 in
@@ -450,7 +449,7 @@ let update_ocaml_info t =
450449 | `Unable_to_parse_version (`Version v , `Msg msg ) ->
451450 show_message
452451 `Error
453- " OCaml bytecode compiler ` ocamlc` version could not be parsed. Version: %s. \
452+ " OCaml bytecode compiler \" ocamlc\" version could not be parsed. Version: %s. \
454453 Error %s"
455454 v
456455 msg
@@ -459,7 +458,7 @@ let update_ocaml_info t =
459458 let + maybe_choice =
460459 Window. showWarningMessage
461460 ~message:
462- " OCaml bytecode compiler ` ocamlc` was not found in the current sandbox. \
461+ " OCaml bytecode compiler \" ocamlc\" was not found in the current sandbox. \
463462 Do you have OCaml installed in the current sandbox?"
464463 ~choices:
465464 [ ( " Pick another sandbox"
0 commit comments