Skip to content

Commit 9c17c78

Browse files
committed
Merge branch 'master' of github.com:ocaml/ocaml-lsp into polarity_search
2 parents 080d88e + 8b47925 commit 9c17c78

File tree

19 files changed

+828
-423
lines changed

19 files changed

+828
-423
lines changed

CHANGES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,14 @@
33
- Add custom
44
[`ocamllsp/typeSearch`](/ocaml-lsp-server/docs/ocamllsp/typeSearch-spec.md) request (#1369)
55

6+
- Make MerlinJump code action configurable (#1376)
7+
68
## Fixes
79

810
- Fix fd leak in running external processes for preprocessing (#1349)
911
- Fix prefix parsing for completion of object methods (#1363, fixes #1358)
12+
- Remove some duplicates in the `selectionRange` answers (#1368)
13+
1014

1115
# 1.19.0
1216

dune-project

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ possible and does not make any assumptions about IO.
6969
(csexp (>= 1.5))
7070
(ocamlformat-rpc-lib (>= 0.21.0))
7171
(odoc :with-doc)
72-
(merlin-lib (and (>= 5.0) (< 6.0)))))
72+
(merlin-lib (and (>= 5.2) (< 6.0)))))
7373

7474
(package
7575
(name jsonrpc)

flake.nix

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,13 @@
7272
uutf
7373
];
7474
checkInputs = let p = pkgs.ocamlPackages;
75-
in [ p.stdune p.cinaps p.ppx_expect p.ppx_yojson_conv (ocamlformat pkgs) ];
75+
in [
76+
p.stdune
77+
p.cinaps
78+
p.ppx_expect
79+
p.ppx_yojson_conv
80+
(ocamlformat pkgs)
81+
];
7682
});
7783

7884
ocaml-lsp = with pkgs.ocamlPackages;
@@ -140,15 +146,15 @@
140146
devShell = localPackages: nixpkgs:
141147
nixpkgs.mkShell {
142148
buildInputs = [ nixpkgs.ocamlPackages.utop ];
143-
inputsFrom = builtins.map (x: x.overrideAttrs(p: n: { doCheck = true; }))
149+
inputsFrom =
150+
builtins.map (x: x.overrideAttrs (p: n: { doCheck = true; }))
144151
(builtins.attrValues localPackages);
145152
};
146153
in {
147-
packages =
148-
(localPackages_5_2 // {
149-
default = localPackages_5_2.ocaml-lsp;
150-
ocaml_5_1 = localPackages_5_1;
151-
});
154+
packages = (localPackages_5_2 // {
155+
default = localPackages_5_2.ocaml-lsp;
156+
ocaml_5_1 = localPackages_5_1;
157+
});
152158

153159
devShells = {
154160
default = devShell localPackages_5_2 pkgs_5_2;

lsp/src/uri0.ml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@ type t = Uri_lexer.t =
1414
; authority : string
1515
; path : string
1616
; query : string option
17+
; fragment : string option
1718
}
1819

1920
let query t = t.query
21+
let fragment t = t.fragment
2022

2123
let backslash_to_slash =
2224
String.map ~f:(function
@@ -35,7 +37,7 @@ let of_path path =
3537
Uri_lexer.of_path path
3638
;;
3739

38-
let to_path { path; authority; scheme; query } =
40+
let to_path { path; authority; scheme; query; _ } =
3941
let path =
4042
let len = String.length path in
4143
if len = 0
@@ -104,7 +106,7 @@ let encode ?(allow_slash = false) s =
104106
Buffer.contents buf
105107
;;
106108

107-
let to_string { scheme; authority; path; query } =
109+
let to_string { scheme; authority; path; query; fragment } =
108110
let buff = Buffer.create 64 in
109111
if not (String.is_empty scheme)
110112
then (
@@ -147,6 +149,11 @@ let to_string { scheme; authority; path; query } =
147149
| Some q ->
148150
Buffer.add_char buff '?';
149151
Buffer.add_string buff (encode q));
152+
(match fragment with
153+
| None -> ()
154+
| Some f ->
155+
Buffer.add_char buff '#';
156+
Buffer.add_string buff (encode f));
150157
Buffer.contents buff
151158
;;
152159

lsp/src/uri0.mli

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ val hash : t -> int
1010
val to_path : t -> string
1111
val of_path : string -> t
1212
val to_string : t -> string
13+
val of_string : string -> t
1314
val query : t -> string option
15+
val fragment : t -> string option
1416

1517
module Private : sig
1618
val win32 : bool ref

lsp/src/uri_lexer.mli

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ type t =
33
; authority : string
44
; path : string
55
; query : string option
6+
; fragment : string option
67
}
78

89
val of_string : string -> t

lsp/src/uri_lexer.mll

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ type t =
77
; authority : string
88
; path : string
99
; query: string option
10+
; fragment: string option
1011
}
1112

1213
let int_of_hex_char c =
@@ -84,7 +85,8 @@ and uri = parse
8485
([^':' '/' '?' '#']+ as scheme ':') ?
8586
("//" ([^ '/' '?' '#']* as authority)) ?
8687
([^ '?' '#']* as path)
87-
(('?' ([^ '#']* as raw_query) '#'?)) ?
88+
('?' ([^ '#']* as raw_query)) ?
89+
('#' (_ * as fragment)) ?
8890
{
8991
let scheme = scheme |> Option.value ~default:"file" in
9092
let authority =
@@ -102,15 +104,15 @@ and uri = parse
102104
| None -> None
103105
| Some c -> Some (query (Buffer.create (String.length c)) (Lexing.from_string c))
104106
in
105-
{ scheme; authority; path; query }
107+
{ scheme; authority; path; query; fragment }
106108
}
107109

108110
and path = parse
109-
| "" { { scheme = "file"; authority = ""; path = "/"; query = None } }
110-
| "//" ([^ '/']* as authority) (['/']_* as path) { { scheme = "file"; authority; path ; query = None } }
111-
| "//" ([^ '/']* as authority) { { scheme = "file"; authority; path = "/" ; query = None } }
112-
| ("/" _* as path) { { scheme = "file"; authority = ""; path ; query = None } }
113-
| (_* as path) { { scheme = "file"; authority = ""; path = "/" ^ path ; query = None } }
111+
| "" { { scheme = "file"; authority = ""; path = "/"; query = None; fragment = None } }
112+
| "//" ([^ '/']* as authority) (['/']_* as path) { { scheme = "file"; authority; path ; query = None ; fragment = None } }
113+
| "//" ([^ '/']* as authority) { { scheme = "file"; authority; path = "/" ; query = None ; fragment = None } }
114+
| ("/" _* as path) { { scheme = "file"; authority = ""; path ; query = None ; fragment = None } }
115+
| (_* as path) { { scheme = "file"; authority = ""; path = "/" ^ path ; query = None ; fragment = None } }
114116

115117
{
116118
let of_string s =

lsp/test/uri_tests.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ let%expect_test "of_string -> to_string" =
255255
[%expect
256256
{|
257257
Unix:
258-
file://shares/pröjects/c%23/#l12 -> file://shares/pr%C3%B6jects/c%23/
258+
file://shares/pröjects/c%23/#l12 -> file://shares/pr%C3%B6jects/c%23/#l12
259259
file://sh%c3%a4res/path -> file://sh%C3%A4res/path
260260
untitled:c:/Users/jrieken/Code/abc.txt -> untitled:c%3A/Users/jrieken/Code/abc.txt
261261
untitled:C:/Users/jrieken/Code/abc.txt -> untitled:c%3A/Users/jrieken/Code/abc.txt
@@ -267,7 +267,7 @@ let%expect_test "of_string -> to_string" =
267267
file:///pro%2Fjects/ -> file:///pro/jects/
268268
vscode://mount/test.ml -> vscode://mount/test.ml
269269
Windows:
270-
file://shares/pröjects/c%23/#l12 -> file://shares/pr%C3%B6jects/c%23/
270+
file://shares/pröjects/c%23/#l12 -> file://shares/pr%C3%B6jects/c%23/#l12
271271
file://sh%c3%a4res/path -> file://sh%C3%A4res/path
272272
untitled:c:/Users/jrieken/Code/abc.txt -> untitled:c%3A/Users/jrieken/Code/abc.txt
273273
untitled:C:/Users/jrieken/Code/abc.txt -> untitled:c%3A/Users/jrieken/Code/abc.txt

ocaml-lsp-server.opam

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ depends: [
4545
"csexp" {>= "1.5"}
4646
"ocamlformat-rpc-lib" {>= "0.21.0"}
4747
"odoc" {with-doc}
48-
"merlin-lib" {>= "5.0" & < "6.0"}
48+
"merlin-lib" {>= "5.2" & < "6.0"}
4949
]
5050
dev-repo: "git+https://github.com/ocaml/ocaml-lsp.git"
5151
build: [

ocaml-lsp-server/docs/ocamllsp/config.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,12 @@ interface config {
4242
* @since 1.18
4343
*/
4444
syntaxDocumentation: { enable : boolean }
45+
46+
/**
47+
* Enable/Disable Merlin Jump code actions
48+
* @default true
49+
* @since 1.19
50+
*/
51+
merlinJumpCodeActions: { enable : boolean }
4552
}
4653
```

0 commit comments

Comments
 (0)