Skip to content

Commit

Permalink
Merge branch 'master' of github.com:ocaml/ocaml-lsp into polarity_search
Browse files Browse the repository at this point in the history
  • Loading branch information
PizieDust committed Oct 1, 2024
2 parents a56130b + d5519dd commit c8bc4de
Show file tree
Hide file tree
Showing 27 changed files with 441 additions and 53 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/nix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
with:
submodules: true
- name: nix
uses: cachix/install-nix-action@V28
uses: cachix/install-nix-action@v29
with:
nix_path: nixpkgs=channel:nixos-unstable
- run: nix develop .#check -c make nix-tests
Expand All @@ -25,7 +25,7 @@ jobs:
with:
submodules: true
- name: nix
uses: cachix/install-nix-action@V28
uses: cachix/install-nix-action@v29
with:
nix_path: nixpkgs=channel:nixos-unstable
- run: nix develop .#fmt -c make nix-fmt
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
- Kill unnecessary ocamlformat processes with sigterm rather than sigint or
sigkill (#1343)

## Features

- Add custom [`ocamllsp/construct`](https://github.com/ocaml/ocaml-lsp/blob/ocaml-lsp-server/docs/ocamllsp/construct-spec.md) request (#1348)

# 1.18.0

## Features
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.17.0' \
opam install --yes cinaps 'ppx_expect>=v0.17.0' \
ocamlformat.$$(awk -F = '$$1 == "version" {print $$2}' .ocamlformat)

.PHONY: dev
Expand Down
2 changes: 1 addition & 1 deletion dune
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@

(env
(_
(flags :standard -alert -unstable)))
(flags :standard -alert -unstable -w -58)))
4 changes: 2 additions & 2 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) (< 0.17.0) :with-test))
(ppx_expect (and (>= v0.17.0) :with-test))
(uutf (>= 1.0.2))
(odoc :with-doc)
(ocaml (>= 4.14))))
Expand Down Expand Up @@ -62,7 +62,7 @@ possible and does not make any assumptions about IO.
spawn
astring
camlp-streams
(ppx_expect (and (>= v0.15.0) (< 0.17.0) :with-test))
(ppx_expect (and (>= v0.17.0) :with-test))
(ocamlformat (and :with-test (= 0.26.2)))
(ocamlc-loc (>= 3.7.0))
(pp (>= 1.1.2))
Expand Down
90 changes: 71 additions & 19 deletions flake.lock

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

33 changes: 20 additions & 13 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
merlin4_14 = {
url = "github:ocaml/merlin/v4.16-414";
nixpkgs.url = "github:nix-ocaml/nix-overlays";
merlin5_2 = {
url = "github:ocaml/merlin/main";
flake = false;
};
merlin5_2 = {
url = "github:ocaml/merlin/v5.1-502";
merlin5_1 = {
url = "github:ocaml/merlin/501";
flake = false;
};
};
Expand Down Expand Up @@ -58,24 +58,27 @@
in rec {
jsonrpc = buildDunePackage (basePackage // {
pname = "jsonrpc";
doCheck = false;
propagatedBuildInputs = with pkgs.ocamlPackages; [ ];
});

lsp = buildDunePackage (basePackage // {
pname = "lsp";
doCheck = false;
propagatedBuildInputs = with pkgs.ocamlPackages; [
jsonrpc
yojson
ppx_yojson_conv_lib
uutf
];
checkInputs = let p = pkgs.ocamlPackages;
in [ p.cinaps p.ppx_expect p.ppx_yojson_conv (ocamlformat pkgs) ];
in [ p.stdune p.cinaps p.ppx_expect p.ppx_yojson_conv (ocamlformat pkgs) ];
});

ocaml-lsp = with pkgs.ocamlPackages;
buildDunePackage (basePackage // {
pname = package;
doCheck = false;
checkInputs = let p = pkgs.ocamlPackages;
in [
p.ppx_expect
Expand Down Expand Up @@ -128,26 +131,30 @@
overlays = [ (ocamlVersionOverlay ocaml) (overlay merlin) ];
inherit system;
};
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;
inputsFrom = builtins.map (x: x.overrideAttrs(p: n: { doCheck = true; }))
(builtins.attrValues localPackages);
};
in {
packages =
(localPackages_5_2 // { default = localPackages_5_2.ocaml-lsp; });
(localPackages_5_2 // {
default = localPackages_5_2.ocaml-lsp;
ocaml_5_1 = localPackages_5_1;
});

devShells = {
ocaml4_11 = devShell localPackages_4_14 pkgs_4_14;

default = devShell localPackages_5_2 pkgs_5_2;

ocaml5_1 = devShell localPackages_5_1 pkgs_5_1;

release = pkgsWithoutOverlays.mkShell {
buildInputs = [ pkgsWithoutOverlays.dune-release ];
};
Expand Down
2 changes: 1 addition & 1 deletion jsonrpc-fiber/test/dune
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
jsonrpc_fiber
;; This is because of the (implicit_transitive_deps false)
;; in dune-project
ppx_expect.common
ppx_expect
ppx_expect.config
ppx_expect.config_types
ppx_inline_test.config
Expand Down
2 changes: 1 addition & 1 deletion lsp-fiber/test/dune
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
lsp_fiber
;; This is because of the (implicit_transitive_deps false)
;; in dune-project
ppx_expect.common
ppx_expect
ppx_expect.config
ppx_expect.config_types
ppx_inline_test.config
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" & < "0.17.0" & with-test}
"ppx_expect" {>= "v0.17.0" & with-test}
"uutf" {>= "1.0.2"}
"odoc" {with-doc}
"ocaml" {>= "4.14"}
Expand Down
2 changes: 1 addition & 1 deletion lsp/test/dune
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
;; This is because of the (implicit_transitive_deps false)
;; in dune-project
base
ppx_expect.common
ppx_expect
ppx_expect.config
ppx_expect.config_types
ppx_inline_test.config)
Expand Down
2 changes: 1 addition & 1 deletion ocaml-lsp-server.opam
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ depends: [
"spawn"
"astring"
"camlp-streams"
"ppx_expect" {>= "v0.15.0" & < "0.17.0" & with-test}
"ppx_expect" {>= "v0.17.0" & with-test}
"ocamlformat" {with-test & = "0.26.2"}
"ocamlc-loc" {>= "3.7.0"}
"pp" {>= "1.1.2"}
Expand Down
49 changes: 49 additions & 0 deletions ocaml-lsp-server/docs/ocamllsp/construct-spec.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Construct Request

## Description

Provides commands to fill typed holes (`_`). Such holes sometimes
appear in the result of other commands like `destruct` and can also be inserted
manually in the source. The command is already accessible via a completion hook,
however, in certain situations, invoking `construct` on a hole via a request
allows more control.

## Client Capability

There is no client capability relative to this request.

## Server capability

- property name: `handleConstruct`
- property type: `boolean`

## Request

- method: `ocamllsp/construct`
- params:

```json
{
"uri": TextDocumentIdentifier,
"position": Position
"depth?": uinteger (default value: 0)
"withValues?": <"local" | "none">,
}
```

The `depth` parameter allows to recursively construct terms. Note that
when `depth > 1` partial results of inferior depth will not be
returned. The `withValues` parameter enables the use of values from
the environment (`local`) or not (`none`), It defaults to `none`.

## Response

```json
{
"position": Range,
"result": string[]
}
```

The result contains the range (`position`) to be replaced (describing the hole)
and the list of possible substitution values (`result`).
1 change: 1 addition & 0 deletions ocaml-lsp-server/src/custom_requests/custom_request.ml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
module Construct = Req_construct
module Hover_extended = Req_hover_extended
module Infer_intf = Req_infer_intf
module Merlin_call_compatible = Req_merlin_call_compatible
Expand Down
Loading

0 comments on commit c8bc4de

Please sign in to comment.