@@ -25,10 +25,10 @@ let rec drop_until list ~f =
2525 | false -> drop_until rest ~f )
2626
2727module Loc_comparison_result = struct
28- type t = Before | Inside | After
28+ type t = Before | Inside | After | Ghost
2929
3030 let is_inside = function
31- | Before | After -> false
31+ | Before | After | Ghost -> false
3232 | Inside -> true
3333end
3434
@@ -317,11 +317,14 @@ let get_modality_doc modality =
317317let get_oxcaml_syntax_doc cursor_loc nodes : syntax_info =
318318 (* Merlin-jst specific: This function gets documentation for oxcaml language
319319 extensions. *)
320- let compare_cursor_to_loc loc : Loc_comparison_result.t =
321- match Location_aux. compare_pos cursor_loc loc with
322- | n when n < 0 -> Before
323- | n when n > 0 -> After
324- | _ -> Inside
320+ let compare_cursor_to_loc (loc : Location.t ) : Loc_comparison_result.t =
321+ match loc.loc_ghost with
322+ | true -> Ghost
323+ | false -> (
324+ match Location_aux. compare_pos cursor_loc loc with
325+ | n when n < 0 -> Before
326+ | n when n > 0 -> After
327+ | _ -> Inside )
325328 in
326329 let nodes = List. map nodes ~f: snd in
327330 let nodes =
@@ -336,9 +339,7 @@ let get_oxcaml_syntax_doc cursor_loc nodes : syntax_info =
336339 until we reach one that includes the cursor. *)
337340 drop_until nodes ~f: (fun node ->
338341 let loc = Browse_raw. node_merlin_loc Location. none node in
339- match compare_cursor_to_loc loc with
340- | Inside -> true
341- | Before | After -> false )
342+ Loc_comparison_result. is_inside (compare_cursor_to_loc loc))
342343 in
343344 let stack_allocation_url =
344345 syntax_doc_url Oxcaml " stack-allocation/reference/"
@@ -683,7 +684,8 @@ let get_oxcaml_syntax_doc cursor_loc nodes : syntax_info =
683684 description = " Mark a type as included under a modality" ;
684685 documentation = syntax_doc_url Oxcaml " kinds/intro/" ;
685686 level = Advanced
686- })
687+ }
688+ | Ghost -> None )
687689 (* Module Strengthening *)
688690 | Module_type { mty_desc = Tmty_strengthen (_ , _ , mod_ident ); _ } :: _ -> (
689691 (* Due to a current bug, there is no node for the module name after the `with`, so
@@ -700,7 +702,7 @@ let get_oxcaml_syntax_doc cursor_loc nodes : syntax_info =
700702 " miscellaneous-extensions/module-strengthening/" ;
701703 level = Advanced
702704 }
703- | Inside | After -> None )
705+ | Inside | After | Ghost -> None )
704706 (* Local allocations *)
705707 | Expression { exp_desc = Texp_exclave _ ; _ } :: _ ->
706708 Some
@@ -764,7 +766,7 @@ let get_oxcaml_syntax_doc cursor_loc nodes : syntax_info =
764766 | Attribute attribute -> (
765767 match compare_cursor_to_loc attribute.attr_loc with
766768 | Inside -> get_doc_for_attribute attribute
767- | Before | After -> None )
769+ | Before | After | Ghost -> None )
768770 | _ -> None ))
769771
770772let get_syntax_doc cursor_loc node : syntax_info =
0 commit comments