Skip to content

Commit 0ca33be

Browse files
authored
Merge branch 'master' into welcome_screen
2 parents 615d911 + 517962e commit 0ca33be

18 files changed

+314
-302
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545

4646
- name: Generate artifact attestation
4747
if: github.event_name == 'release'
48-
uses: actions/attest-build-provenance@v2
48+
uses: actions/attest-build-provenance@v3
4949
with:
5050
subject-path: ocaml-platform.vsix
5151

CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,28 @@
33
## Unreleased
44

55
- Add OCaml onboarding welcome screen. (#1737)
6+
- Fix Windows path handling regression introduced in 1.32.1 by using
7+
`Uri.fsPath` instead of `Uri.path` in workspace root detection, preventing
8+
LSP start failures (`ENOENT -4058`). (#1929)
9+
10+
## 1.32.1
11+
12+
- Fix DPM error when invoking `ocamlc --version` without a working directory by
13+
providing an explicit cwd. (#1925)
14+
- Prefer POSIX-style flags for OCaml compiler (e.g. use `-version` instead of
15+
`--version`) to maintain compatibility with older OCaml compilers (< 4.02).
16+
(#1925)
17+
- Unify cwd detection for `Cmd.output` calls by using
18+
`Sandbox.workspace_root ()` where commands depend on the workspace context.
19+
This removes ad-hoc `Workspace.workspaceFolders()` handling and improves
20+
consistency. (#1925)
21+
- Add explicit cwd for tool presence checks executed via the sandbox (e.g.
22+
`utop --version`, `ocamlearlybird --help`, `odig --version`,
23+
`ocamlobjinfo <file>`). This ensures commands resolve correctly under Dune
24+
Package Management. (#1925)
25+
- Replace Markdown backticks in notifications and message popups with double
26+
quotes, since VS Code does not render Markdown in
27+
`showInformationMessage`/`showWarningMessage`/`showErrorMessage`. (#1926)
628

729
## 1.32.0
830

dune-project

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
(lang dune 3.19)
1+
(lang dune 3.20)
22

33
(name vscode-ocaml-platform)
44

flake.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "ocaml-platform",
33
"displayName": "OCaml Platform",
4-
"version": "1.32.0",
4+
"version": "1.32.1",
55
"private": true,
66
"description": "Official OCaml language extension for VSCode",
77
"categories": [
@@ -1471,7 +1471,7 @@
14711471
"ovsx": "0.10.5",
14721472
"typescript": "5.9.2"
14731473
},
1474-
"packageManager": "[email protected].2",
1474+
"packageManager": "[email protected].4",
14751475
"engines": {
14761476
"vscode": "^1.86.0"
14771477
},

src/cm_editor.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ end = struct
2424
let sandbox = Extension_instance.sandbox instance in
2525
Sandbox.get_command sandbox "ocamlobjinfo" [ file_path ] `Exec
2626
in
27-
Cmd.output command
27+
let cwd = Sandbox.workspace_root () in
28+
Cmd.output ?cwd command
2829
;;
2930

3031
let create ~(uri : Uri.t) =

src/earlybird.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ let check_earlybird_available (sandbox : Sandbox.t) =
3838
(* earlybird <= 1.1.0 doesn't have --version *)
3939
Sandbox.get_command sandbox "ocamlearlybird" [ "--help" ] `Tool
4040
in
41-
Cmd.output earlybird_help
41+
let cwd = Sandbox.workspace_root () in
42+
Cmd.output ?cwd earlybird_help
4243
|> Promise.Result.fold
4344
~ok:(fun (_ : string) -> ())
4445
~error:(fun (_ : string) ->

src/extension_commands.ml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ let _install_dune_lsp_server =
108108
let options =
109109
ProgressOptions.create
110110
~location:(`ProgressLocation Notification)
111-
~title:"Installing ocaml-lsp server using `dune tools install ocamllsp`"
111+
~title:"Installing ocaml-lsp server using \"dune tools install ocamllsp\""
112112
~cancellable:false
113113
()
114114
in
@@ -152,7 +152,7 @@ let _run_dune_pkg_lock =
152152
let options =
153153
ProgressOptions.create
154154
~location:(`ProgressLocation Notification)
155-
~title:"Running `dune pkg lock`"
155+
~title:"Running \"dune pkg lock\""
156156
~cancellable:false
157157
()
158158
in
@@ -554,7 +554,7 @@ end = struct
554554
| Error (`Msg msg) ->
555555
show_message
556556
`Warn
557-
"The installed version of `ocamllsp` does not support typed holes. %s"
557+
"The installed version of \"ocamllsp\" does not support typed holes. %s"
558558
msg
559559
;;
560560

@@ -780,7 +780,7 @@ module Copy_type_under_cursor = struct
780780
| Error (`Msg msg) ->
781781
show_message
782782
`Warn
783-
"The installed version of `ocamllsp` does not support type enclosings. %s"
783+
"The installed version of \"ocamllsp\" does not support type enclosings. %s"
784784
msg
785785
;;
786786

@@ -1322,7 +1322,7 @@ module Search_by_type = struct
13221322
let _ =
13231323
Ocaml_lsp.suggest_to_upgrade_ocaml_lsp_server
13241324
~message:
1325-
"The installed version of `ocamllsp` does not support type search."
1325+
"The installed version of \"ocamllsp\" does not support type search."
13261326
()
13271327
in
13281328
()

src/extension_instance.ml

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -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
427423
let 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"

src/odig.ml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ let of_sandbox (sandbox : Sandbox.t) =
1212
let make_odig_cmd = make_odig_cmd sandbox in
1313
let odig_version = make_odig_cmd [ "--version" ] in
1414
let open Promise.Syntax in
15-
let* output = Cmd.output odig_version in
15+
let cwd = Sandbox.workspace_root () in
16+
let* output = Cmd.output ?cwd odig_version in
1617
match output with
1718
| Ok _ ->
18-
let+ cache_dir = Cmd.output (make_odig_cmd [ "cache"; "path" ]) in
19+
let+ cache_dir = Cmd.output ?cwd (make_odig_cmd [ "cache"; "path" ]) in
1920
(match cache_dir with
2021
| Ok cache_dir ->
2122
let cache_dir = cache_dir |> String.strip |> Path.of_string in
@@ -28,7 +29,11 @@ let of_sandbox (sandbox : Sandbox.t) =
2829
generate documentation.")
2930
;;
3031

31-
let cmd_output ~sandbox ~args = Cmd.output (make_odig_cmd sandbox args)
32+
let cmd_output ~sandbox ~args =
33+
let cwd = Sandbox.workspace_root () in
34+
Cmd.output ?cwd (make_odig_cmd sandbox args)
35+
;;
36+
3237
let html_dir t = Path.(t.cache_dir / "/html/")
3338

3439
let odoc_exec t ~sandbox ~package_name =

0 commit comments

Comments
 (0)