File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -11,14 +11,15 @@ type stack_or_heap =
1111type stack_or_heap_enclosings = (Location .t * stack_or_heap ) list
1212
1313let from_nodes ~lsp_compat ~pos ~path =
14- let [@ tail_mod_cons] rec tails = function
15- | hd :: tl -> (hd, tl) :: tails tl
14+ let [@ tail_mod_cons] rec with_parents = function
15+ | node :: parent :: rest -> (node, Some parent) :: with_parents (parent :: rest)
16+ | [ node ] -> [ node, None ]
1617 | [] -> []
1718 in
1819 let cursor_is_inside ({ loc_start; loc_end; _ } : Location.t ) =
1920 Lexing. compare_pos pos loc_start > = 0 && Lexing. compare_pos pos loc_end < = 0
2021 in
21- let aux node parent =
22+ let aux ( node , parent ) =
2223 let open Browse_raw in
2324 let ret ?(loc = Mbrowse. node_loc node) mode_result =
2425 Some (loc, mode_result)
@@ -117,6 +118,5 @@ let from_nodes ~lsp_compat ~pos ~path =
117118 in
118119 path
119120 |> List. map ~f: (fun (_ , node , _ ) -> node)
120- |> tails
121- |> List. filter_map ~f: (fun (node , ancestors ) ->
122- aux node (List. nth_opt ancestors 0 ))
121+ |> with_parents
122+ |> List. filter_map ~f: aux
You can’t perform that action at this time.
0 commit comments