File tree Expand file tree Collapse file tree 4 files changed +30
-13
lines changed Expand file tree Collapse file tree 4 files changed +30
-13
lines changed Original file line number Diff line number Diff line change @@ -53,12 +53,10 @@ let compute_ocaml_code_actions (params : CodeActionParams.t) state doc =
53
53
]
54
54
in
55
55
let batchable, non_batchable =
56
- List. partition_map
57
- ~f: (fun ca ->
58
- match ca.run with
59
- | `Batchable f -> Left f
60
- | `Non_batchable f -> Right f)
61
- enabled_actions
56
+ List. partition_map enabled_actions ~f: (fun ca ->
57
+ match ca.run with
58
+ | `Batchable f -> Base.Either. First f
59
+ | `Non_batchable f -> Second f)
62
60
in
63
61
let * batch_results =
64
62
if List. is_empty batchable
Original file line number Diff line number Diff line change @@ -38,13 +38,34 @@ include struct
38
38
end
39
39
40
40
module List = struct
41
- include Stdune. List
42
- open Base.List
41
+ include Base. List
43
42
43
+ let compare xs ys ~compare =
44
+ Base.List. compare (fun x y -> Ordering. to_int (compare x y)) xs ys
45
+ ;;
46
+
47
+ let sort xs ~compare = sort xs ~compare: (fun x y -> Ordering. to_int (compare x y))
48
+ let fold_left2 xs ys ~init ~f = Stdlib.List. fold_left2 f init xs ys
49
+ let assoc xs key = Assoc. find ~equal: Poly. equal xs key
50
+ let assoc_opt xs key = assoc xs key
51
+ let mem t x ~equal = mem t x ~equal
52
+ let map t ~f = map t ~f
53
+ let concat_map t ~f = concat_map t ~f
54
+ let flatten t = Stdlib.List. flatten t
55
+ let filter_map t ~f = filter_map t ~f
56
+ let fold_left t ~init ~f = fold_left t ~init ~f
44
57
let findi xs ~f = findi xs ~f
58
+ let find_opt xs ~f = find xs ~f
59
+
60
+ let sort_uniq xs ~compare =
61
+ Stdlib.List. sort_uniq (fun x y -> Ordering. to_int (compare x y)) xs
62
+ ;;
63
+
64
+ let for_all xs ~f = for_all xs ~f
45
65
let find_mapi xs ~f = find_mapi xs ~f
46
66
let sub xs ~pos ~len = sub xs ~pos ~len
47
67
let hd_exn t = hd_exn t
68
+ let hd_opt t = hd t
48
69
let nth_exn t n = nth_exn t n
49
70
let hd t = hd t
50
71
let filter t ~f = filter t ~f
Original file line number Diff line number Diff line change @@ -519,6 +519,7 @@ let on_request
519
519
match req with
520
520
| Client_request. UnknownRequest { meth; params } ->
521
521
(match
522
+ List. assoc
522
523
[ ( Req_switch_impl_intf. meth
523
524
, fun ~params state ->
524
525
Fiber. of_thunk (fun () ->
@@ -536,8 +537,7 @@ let on_request
536
537
, Semantic_highlighting.Debug. on_request_full )
537
538
; ( Req_hover_extended. meth
538
539
, fun ~params _ -> Req_hover_extended. on_request ~params rpc )
539
- ]
540
- |> List. assoc_opt meth
540
+ ] meth
541
541
with
542
542
| None ->
543
543
Jsonrpc.Response.Error. raise
Original file line number Diff line number Diff line change @@ -364,9 +364,7 @@ let run server (state : State.t) (params : WorkspaceSymbolParams.t) =
364
364
| Error `Cancelled -> assert false
365
365
| Error (`Exn exn ) -> Exn_with_backtrace. reraise exn )
366
366
in
367
- List. partition_map symbols_results ~f: (function
368
- | Ok r -> Left r
369
- | Error e -> Right e)
367
+ List. partition_result symbols_results
370
368
in
371
369
let + () =
372
370
match errors with
You can’t perform that action at this time.
0 commit comments