Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wip: compatibility with merlin-lib 5.1-502 #1233

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

Expand Down Expand Up @@ -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 .
Expand All @@ -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:
Expand All @@ -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
Expand Down
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Unreelased

## Features

- Add support for OCaml 5.2

## Fixes

- Kill unnecessary ocamlformat processes with sigterm rather than sigint or
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -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))))
Expand All @@ -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)))
voodoos marked this conversation as resolved.
Show resolved Hide resolved
(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)
Expand Down
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
Expand Up @@ -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;
};
};
Expand Down Expand Up @@ -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 ];
Expand All @@ -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;
};
};
}));
Expand Down
2 changes: 1 addition & 1 deletion lsp.opam
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand Down
6 changes: 3 additions & 3 deletions ocaml-lsp-server.opam
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand Down
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
Expand Up @@ -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)
;;

Expand Down
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
Expand Up @@ -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
| _ -> ())
Expand Down
Loading
Loading