Skip to content

Commit

Permalink
Compatibility with merlin-lib 5.1-502 (#1233)
Browse files Browse the repository at this point in the history
  • Loading branch information
voodoos authored Jul 30, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent c91c19c commit 4e74156
Showing 28 changed files with 193 additions and 366 deletions.
17 changes: 8 additions & 9 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -21,10 +21,8 @@ jobs:
- macos-latest
- windows-latest
ocaml-compiler:
- "4.14"
include:
- os: ubuntu-latest
ocaml-compiler: 5.1.x
- "5.2"


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

@@ -52,6 +50,11 @@ jobs:
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: ${{ matrix.ocaml-compiler }}
allow-prerelease-opam: true

# Remove this pin once a compatible version of Merlin has been released
# - name: Pin dev Merlin
# run: opam pin https://github.com/ocaml/merlin.git#master

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

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

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

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

coverage:
@@ -87,7 +86,7 @@ jobs:
- name: Set-up OCaml
uses: ocaml/setup-ocaml@v2
with:
ocaml-compiler: "4.14"
ocaml-compiler: "5.2"
allow-prerelease-opam: true

- name: Set git user
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -4,6 +4,10 @@

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

## Features

- Add support for OCaml 5.2

## Fixes

- Kill unnecessary ocamlformat processes with sigterm rather than sigint or
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ all:
# results in a conflict
.PHONY: install-test-deps
install-test-deps:
opam install --yes cinaps 'ppx_expect>=v0.15.0' \
opam install --yes cinaps 'ppx_expect<v0.17.0' \
ocamlformat.$$(awk -F = '$$1 == "version" {print $$2}' .ocamlformat)

.PHONY: dev
10 changes: 5 additions & 5 deletions dune-project
Original file line number Diff line number Diff line change
@@ -34,7 +34,7 @@ possible and does not make any assumptions about IO.
yojson
(ppx_yojson_conv_lib (>= "v0.14"))
(cinaps :with-test)
(ppx_expect (and (>= v0.15.0) :with-test))
(ppx_expect (and (>= v0.15.0) (< 0.17.0) :with-test))
(uutf (>= 1.0.2))
(odoc :with-doc)
(ocaml (>= 4.14))))
@@ -55,21 +55,21 @@ possible and does not make any assumptions about IO.
dyn
stdune
(fiber (and (>= 3.1.1) (< 4.0.0)))
(ocaml (>= 5.2.0))
xdg
ordering
dune-build-info
spawn
astring
camlp-streams
(ppx_expect (and (>= v0.15.0) :with-test))
(ocamlformat (and :with-test (= 0.26.2)))
(ppx_expect (and (>= v0.15.0) (< 0.17.0) :with-test))
(ocamlformat (and :with-test (= 0.26.1)))
(ocamlc-loc (>= 3.7.0))
(pp (>= 1.1.2))
(csexp (>= 1.5))
(ocamlformat-rpc-lib (>= 0.21.0))
(odoc :with-doc)
(ocaml (and (>= 4.14) (< 5.2)))
(merlin-lib (and (>= 4.16) (< 5.0)))))
(merlin-lib (and (>= 5.0) (< 6.0)))))

(package
(name jsonrpc)
18 changes: 9 additions & 9 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -6,8 +6,8 @@
url = "github:ocaml/merlin/v4.16-414";
flake = false;
};
merlin5_1 = {
url = "github:ocaml/merlin/v4.16-501";
merlin5_2 = {
url = "github:ocaml/merlin/v5.1-502";
flake = false;
};
};
@@ -130,23 +130,23 @@
};
pkgs_4_14 =
makeNixpkgs (ocaml: ocaml.ocamlPackages_4_14) inputs.merlin4_14;
pkgs_5_1 =
makeNixpkgs (ocaml: ocaml.ocamlPackages_5_1) inputs.merlin5_1;
pkgs_5_2 =
makeNixpkgs (ocaml: ocaml.ocamlPackages_5_2) inputs.merlin5_2;
localPackages_4_14 = makeLocalPackages pkgs_4_14;
localPackages_5_1 = makeLocalPackages pkgs_5_1;
localPackages_5_2 = makeLocalPackages pkgs_5_2;
devShell = localPackages: nixpkgs:
nixpkgs.mkShell {
buildInputs = [ nixpkgs.ocamlPackages.utop ];
inputsFrom = builtins.attrValues localPackages;
};
in {
packages =
(localPackages_4_14 // { default = localPackages_4_14.ocaml-lsp; });
(localPackages_5_2 // { default = localPackages_5_2.ocaml-lsp; });

devShells = {
default = devShell localPackages_4_14 pkgs_4_14;
ocaml4_11 = devShell localPackages_4_14 pkgs_4_14;

ocaml5_1 = devShell localPackages_5_1 pkgs_5_1;
default = devShell localPackages_5_2 pkgs_5_2;

release = pkgsWithoutOverlays.mkShell {
buildInputs = [ pkgsWithoutOverlays.dune-release ];
@@ -163,8 +163,8 @@
];
};

check = pkgs_4_14.mkShell {
inputsFrom = builtins.attrValues localPackages_4_14;
check = pkgs_5_2.mkShell {
inputsFrom = builtins.attrValues localPackages_5_2;
};
};
}));
2 changes: 1 addition & 1 deletion lsp.opam
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@ depends: [
"yojson"
"ppx_yojson_conv_lib" {>= "v0.14"}
"cinaps" {with-test}
"ppx_expect" {>= "v0.15.0" & with-test}
"ppx_expect" {>= "v0.15.0" & < "0.17.0" & with-test}
"uutf" {>= "1.0.2"}
"odoc" {with-doc}
"ocaml" {>= "4.14"}
6 changes: 3 additions & 3 deletions ocaml-lsp-server.opam
Original file line number Diff line number Diff line change
@@ -31,21 +31,21 @@ depends: [
"dyn"
"stdune"
"fiber" {>= "3.1.1" & < "4.0.0"}
"ocaml" {>= "5.2.0"}
"xdg"
"ordering"
"dune-build-info"
"spawn"
"astring"
"camlp-streams"
"ppx_expect" {>= "v0.15.0" & with-test}
"ppx_expect" {>= "v0.15.0" & < "0.17.0" & with-test}
"ocamlformat" {with-test & = "0.26.2"}
"ocamlc-loc" {>= "3.7.0"}
"pp" {>= "1.1.2"}
"csexp" {>= "1.5"}
"ocamlformat-rpc-lib" {>= "0.21.0"}
"odoc" {with-doc}
"ocaml" {>= "4.14" & < "5.2"}
"merlin-lib" {>= "4.16" & < "5.0"}
"merlin-lib" {>= "5.0" & < "6.0"}
]
dev-repo: "git+https://github.com/ocaml/ocaml-lsp.git"
build: [
2 changes: 1 addition & 1 deletion ocaml-lsp-server/src/code_actions/action_add_rec.ml
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ let action_title = "Add missing `rec` keyword"
let let_bound_vars bindings =
List.filter_map bindings ~f:(fun vb ->
match vb.Typedtree.vb_pat.pat_desc with
| Typedtree.Tpat_var (id, loc) -> Some (id, loc)
| Typedtree.Tpat_var (id, loc, _) -> Some (id, loc)
| _ -> None)
;;

2 changes: 1 addition & 1 deletion ocaml-lsp-server/src/code_actions/action_extract.ml
Original file line number Diff line number Diff line change
@@ -74,7 +74,7 @@ let tightest_enclosing_binder_position typedtree range =
| Texp_letexception (_, body)
| Texp_open (_, body) -> found_if_expr_contains body
| Texp_letop { body; _ } -> found_if_case_contains [ body ]
| Texp_function { cases; _ } -> found_if_case_contains cases
| Texp_function (_, Tfunction_cases { cases; _ }) -> found_if_case_contains cases
| Texp_match (_, cases, _) -> found_if_case_contains cases
| Texp_try (_, cases) -> found_if_case_contains cases
| _ -> ())
Loading

0 comments on commit 4e74156

Please sign in to comment.