Skip to content

Commit

Permalink
Use find_mapi from Base
Browse files Browse the repository at this point in the history
  • Loading branch information
xvw committed Jul 1, 2024
1 parent 87a7d4d commit cb8b966
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 1 addition & 3 deletions ocaml-lsp-server/src/custom_requests/req_type_enclosing.ml
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,7 @@ let make_enclosing_command position index =
Query_protocol.Type_enclosing (None, position, Some index)

let get_first_enclosing_index range_end enclosings =
List.find_mapi
~f:(fun i (loc, _, _) ->
List.find_mapi enclosings ~f:(fun i (loc, _, _) ->
let range = Range.of_loc loc in
match
( Position.compare range_end range.start
Expand All @@ -119,7 +118,6 @@ let get_first_enclosing_index range_end enclosings =
| Ordering.Lt, Ordering.Eq
| Ordering.Lt, Ordering.Gt
| Ordering.Eq, Ordering.Gt -> None)
enclosings

let dispatch_command pipeline command first_index index =
let rec aux i acc = function
Expand Down
2 changes: 2 additions & 0 deletions ocaml-lsp-server/src/import.ml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ include struct

let findi xs ~f = List.findi xs ~f

let find_mapi xs ~f = find_mapi xs ~f

let sub xs ~pos ~len = List.sub xs ~pos ~len

let hd_exn t = List.hd_exn t
Expand Down

0 comments on commit cb8b966

Please sign in to comment.