Skip to content

Commit

Permalink
Run ocamllsp -version in workspace dir
Browse files Browse the repository at this point in the history
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 <stephen@sherra.tt>
  • Loading branch information
gridbugs authored and smorimoto committed Nov 12, 2024
1 parent 52fac75 commit f238b11
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 7 additions & 1 deletion src/extension_instance.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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) ->
Expand Down

0 comments on commit f238b11

Please sign in to comment.