From f238b11a67b7dd6292ebe4936fbaeb392ee5183a Mon Sep 17 00:00:00 2001 From: Stephen Sherratt Date: Fri, 8 Nov 2024 18:14:15 +1100 Subject: [PATCH] Run ocamllsp -version in workspace dir This is needed when dune is managing the installation of ocamllsp, as it needs to determine which version of ocamllsp to run by looking in the current project's lockdir. Signed-off-by: Stephen Sherratt --- CHANGELOG.md | 4 ++-- src/extension_instance.ml | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f5c8de7b3..b8fcd0cf8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,9 +2,9 @@ # Unreleased -- Add `ocaml.copy-type-under-cursor` to copy, in the clipboard the type of +- Add `ocaml.copy-type-under-cursor` to copy, in the clipboard the type of the expression under the cursor (#1582) - +- Run ocamllsp -version in workspace dir (#1641) - Make it a warning if ocamlc is missing (#1642) ## 1.20.1 diff --git a/src/extension_instance.ml b/src/extension_instance.ml index 2d4fd0f2e..aed54a795 100644 --- a/src/extension_instance.ml +++ b/src/extension_instance.ml @@ -140,7 +140,13 @@ end = struct let ocaml_lsp_version sandbox = Sandbox.get_command sandbox "ocamllsp" [ "--version" ] in - Cmd.output (ocaml_lsp_version sandbox) + let cwd = + match Workspace.workspaceFolders () with + | [ cwd ] -> + Some (cwd |> WorkspaceFolder.uri |> Uri.path |> Path.of_string) + | _ -> None + in + Cmd.output ?cwd (ocaml_lsp_version sandbox) |> Promise.Result.fold ~ok:(fun (_ : string) -> ()) ~error:(fun (_ : string) ->