Skip to content

Commit 4e74156

Browse files
authored
Compatibility with merlin-lib 5.1-502 (#1233)
1 parent c91c19c commit 4e74156

28 files changed

+193
-366
lines changed

.github/workflows/build-and-test.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,8 @@ jobs:
2121
- macos-latest
2222
- windows-latest
2323
ocaml-compiler:
24-
- "4.14"
25-
include:
26-
- os: ubuntu-latest
27-
ocaml-compiler: 5.1.x
24+
- "5.2"
25+
2826

2927
runs-on: ${{ matrix.os }}
3028

@@ -52,6 +50,11 @@ jobs:
5250
uses: ocaml/setup-ocaml@v3
5351
with:
5452
ocaml-compiler: ${{ matrix.ocaml-compiler }}
53+
allow-prerelease-opam: true
54+
55+
# Remove this pin once a compatible version of Merlin has been released
56+
# - name: Pin dev Merlin
57+
# run: opam pin https://github.com/ocaml/merlin.git#master
5558

5659
- name: Build and install dependencies
5760
run: opam install .
@@ -60,19 +63,15 @@ jobs:
6063
# ppx expect is not yet compatible with 5.1 and test output vary from one
6164
# compiler to another. We only test on 4.14.
6265
- name: Install test dependencies
63-
if: matrix.ocaml-compiler == '4.14'
6466
run: opam exec -- make install-test-deps
6567

6668
- name: Run build @all
67-
if: matrix.ocaml-compiler == '4.14'
6869
run: opam exec -- make all
6970

7071
- name: Run the unit tests
71-
if: matrix.ocaml-compiler == '4.14'
7272
run: opam exec -- make test-ocaml
7373

7474
- name: Run the template integration tests
75-
if: matrix.ocaml-compiler == '4.14'
7675
run: opam exec -- make test-e2e
7776

7877
coverage:
@@ -87,7 +86,7 @@ jobs:
8786
- name: Set-up OCaml
8887
uses: ocaml/setup-ocaml@v2
8988
with:
90-
ocaml-compiler: "4.14"
89+
ocaml-compiler: "5.2"
9190
allow-prerelease-opam: true
9291

9392
- name: Set git user

CHANGES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44

55
- Add custom [`ocamllsp/getDocumentation`](/ocaml-lsp-server/docs/ocamllsp/getDocumentation-spec.md) request (#1336)
66

7+
## Features
8+
9+
- Add support for OCaml 5.2
10+
711
## Fixes
812

913
- Kill unnecessary ocamlformat processes with sigterm rather than sigint or

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ all:
1717
# results in a conflict
1818
.PHONY: install-test-deps
1919
install-test-deps:
20-
opam install --yes cinaps 'ppx_expect>=v0.15.0' \
20+
opam install --yes cinaps 'ppx_expect<v0.17.0' \
2121
ocamlformat.$$(awk -F = '$$1 == "version" {print $$2}' .ocamlformat)
2222

2323
.PHONY: dev

dune-project

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ possible and does not make any assumptions about IO.
3434
yojson
3535
(ppx_yojson_conv_lib (>= "v0.14"))
3636
(cinaps :with-test)
37-
(ppx_expect (and (>= v0.15.0) :with-test))
37+
(ppx_expect (and (>= v0.15.0) (< 0.17.0) :with-test))
3838
(uutf (>= 1.0.2))
3939
(odoc :with-doc)
4040
(ocaml (>= 4.14))))
@@ -55,21 +55,21 @@ possible and does not make any assumptions about IO.
5555
dyn
5656
stdune
5757
(fiber (and (>= 3.1.1) (< 4.0.0)))
58+
(ocaml (>= 5.2.0))
5859
xdg
5960
ordering
6061
dune-build-info
6162
spawn
6263
astring
6364
camlp-streams
64-
(ppx_expect (and (>= v0.15.0) :with-test))
65-
(ocamlformat (and :with-test (= 0.26.2)))
65+
(ppx_expect (and (>= v0.15.0) (< 0.17.0) :with-test))
66+
(ocamlformat (and :with-test (= 0.26.1)))
6667
(ocamlc-loc (>= 3.7.0))
6768
(pp (>= 1.1.2))
6869
(csexp (>= 1.5))
6970
(ocamlformat-rpc-lib (>= 0.21.0))
7071
(odoc :with-doc)
71-
(ocaml (and (>= 4.14) (< 5.2)))
72-
(merlin-lib (and (>= 4.16) (< 5.0)))))
72+
(merlin-lib (and (>= 5.0) (< 6.0)))))
7373

7474
(package
7575
(name jsonrpc)

flake.lock

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

flake.nix

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
url = "github:ocaml/merlin/v4.16-414";
77
flake = false;
88
};
9-
merlin5_1 = {
10-
url = "github:ocaml/merlin/v4.16-501";
9+
merlin5_2 = {
10+
url = "github:ocaml/merlin/v5.1-502";
1111
flake = false;
1212
};
1313
};
@@ -130,23 +130,23 @@
130130
};
131131
pkgs_4_14 =
132132
makeNixpkgs (ocaml: ocaml.ocamlPackages_4_14) inputs.merlin4_14;
133-
pkgs_5_1 =
134-
makeNixpkgs (ocaml: ocaml.ocamlPackages_5_1) inputs.merlin5_1;
133+
pkgs_5_2 =
134+
makeNixpkgs (ocaml: ocaml.ocamlPackages_5_2) inputs.merlin5_2;
135135
localPackages_4_14 = makeLocalPackages pkgs_4_14;
136-
localPackages_5_1 = makeLocalPackages pkgs_5_1;
136+
localPackages_5_2 = makeLocalPackages pkgs_5_2;
137137
devShell = localPackages: nixpkgs:
138138
nixpkgs.mkShell {
139139
buildInputs = [ nixpkgs.ocamlPackages.utop ];
140140
inputsFrom = builtins.attrValues localPackages;
141141
};
142142
in {
143143
packages =
144-
(localPackages_4_14 // { default = localPackages_4_14.ocaml-lsp; });
144+
(localPackages_5_2 // { default = localPackages_5_2.ocaml-lsp; });
145145

146146
devShells = {
147-
default = devShell localPackages_4_14 pkgs_4_14;
147+
ocaml4_11 = devShell localPackages_4_14 pkgs_4_14;
148148

149-
ocaml5_1 = devShell localPackages_5_1 pkgs_5_1;
149+
default = devShell localPackages_5_2 pkgs_5_2;
150150

151151
release = pkgsWithoutOverlays.mkShell {
152152
buildInputs = [ pkgsWithoutOverlays.dune-release ];
@@ -163,8 +163,8 @@
163163
];
164164
};
165165

166-
check = pkgs_4_14.mkShell {
167-
inputsFrom = builtins.attrValues localPackages_4_14;
166+
check = pkgs_5_2.mkShell {
167+
inputsFrom = builtins.attrValues localPackages_5_2;
168168
};
169169
};
170170
}));

lsp.opam

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ depends: [
2828
"yojson"
2929
"ppx_yojson_conv_lib" {>= "v0.14"}
3030
"cinaps" {with-test}
31-
"ppx_expect" {>= "v0.15.0" & with-test}
31+
"ppx_expect" {>= "v0.15.0" & < "0.17.0" & with-test}
3232
"uutf" {>= "1.0.2"}
3333
"odoc" {with-doc}
3434
"ocaml" {>= "4.14"}

ocaml-lsp-server.opam

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,21 @@ depends: [
3131
"dyn"
3232
"stdune"
3333
"fiber" {>= "3.1.1" & < "4.0.0"}
34+
"ocaml" {>= "5.2.0"}
3435
"xdg"
3536
"ordering"
3637
"dune-build-info"
3738
"spawn"
3839
"astring"
3940
"camlp-streams"
40-
"ppx_expect" {>= "v0.15.0" & with-test}
41+
"ppx_expect" {>= "v0.15.0" & < "0.17.0" & with-test}
4142
"ocamlformat" {with-test & = "0.26.2"}
4243
"ocamlc-loc" {>= "3.7.0"}
4344
"pp" {>= "1.1.2"}
4445
"csexp" {>= "1.5"}
4546
"ocamlformat-rpc-lib" {>= "0.21.0"}
4647
"odoc" {with-doc}
47-
"ocaml" {>= "4.14" & < "5.2"}
48-
"merlin-lib" {>= "4.16" & < "5.0"}
48+
"merlin-lib" {>= "5.0" & < "6.0"}
4949
]
5050
dev-repo: "git+https://github.com/ocaml/ocaml-lsp.git"
5151
build: [

ocaml-lsp-server/src/code_actions/action_add_rec.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ let action_title = "Add missing `rec` keyword"
66
let let_bound_vars bindings =
77
List.filter_map bindings ~f:(fun vb ->
88
match vb.Typedtree.vb_pat.pat_desc with
9-
| Typedtree.Tpat_var (id, loc) -> Some (id, loc)
9+
| Typedtree.Tpat_var (id, loc, _) -> Some (id, loc)
1010
| _ -> None)
1111
;;
1212

ocaml-lsp-server/src/code_actions/action_extract.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ let tightest_enclosing_binder_position typedtree range =
7474
| Texp_letexception (_, body)
7575
| Texp_open (_, body) -> found_if_expr_contains body
7676
| Texp_letop { body; _ } -> found_if_case_contains [ body ]
77-
| Texp_function { cases; _ } -> found_if_case_contains cases
77+
| Texp_function (_, Tfunction_cases { cases; _ }) -> found_if_case_contains cases
7878
| Texp_match (_, cases, _) -> found_if_case_contains cases
7979
| Texp_try (_, cases) -> found_if_case_contains cases
8080
| _ -> ())

0 commit comments

Comments
 (0)