File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -494,8 +494,8 @@ type weather2 =
494494
495495(** The comment for type my_record *)
496496type my_record = {
497- val foo : int ; (** Comment for field foo *)
498- val bar : string ; (** Comment for field bar *)
497+ foo : int ; (** Comment for field foo *)
498+ bar : string ; (** Comment for field bar *)
499499 }
500500 (** Continuation of comment for type my_record *)
501501
@@ -541,8 +541,8 @@ class type my_class_type =
541541end
542542
543543(** The comment for module Foo *)
544- module Foo =
545- struct
544+ module Foo :
545+ sig
546546 (** The comment for x *)
547547 val x : int
548548
@@ -556,8 +556,8 @@ module type my_module_type =
556556 val x : int
557557
558558 (** The comment for module M. *)
559- module M =
560- struct
559+ module M :
560+ sig
561561 (** The comment for value y. *)
562562 val y : int
563563
@@ -606,8 +606,8 @@ type weather =
606606
607607(** The comment for type my_record *)
608608type my_record = {
609- val foo : int ; (** Comment for field foo *)
610- val bar : string ; (** Comment for field bar *)
609+ foo : int ; (** Comment for field foo *)
610+ bar : string ; (** Comment for field bar *)
611611 }
612612
613613(** The comment for class my_class *)
Original file line number Diff line number Diff line change @@ -243,6 +243,12 @@ let get_text pos =
243243 get_docstrings dsl
244244 with Not_found -> []
245245
246+ let get_post_text pos =
247+ try
248+ let dsl = Hashtbl. find post_table pos in
249+ get_docstrings dsl
250+ with Not_found -> []
251+
246252(* Maps from positions to extra docstrings *)
247253
248254let pre_extra_table : (Lexing.position, docstring list) Hashtbl.t =
@@ -315,6 +321,9 @@ let symbol_text_lazy () =
315321let rhs_text pos =
316322 get_text (Parsing. rhs_start_pos pos)
317323
324+ let rhs_post_text pos =
325+ get_post_text (Parsing. rhs_end_pos pos)
326+
318327let rhs_text_lazy pos =
319328 let pos = Parsing. rhs_start_pos pos in
320329 lazy (get_text pos)
Original file line number Diff line number Diff line change @@ -155,3 +155,6 @@ val rhs_pre_extra_text : int -> text
155155
156156(* * Fetch additional text following the symbol at the given position *)
157157val rhs_post_extra_text : int -> text
158+
159+ (* * Fetch text following the symbol at the given position *)
160+ val rhs_post_text : int -> text
Original file line number Diff line number Diff line change @@ -290,9 +290,15 @@ let text_csig pos = Ctf.text (rhs_text pos)
290290let text_def pos = [Ptop_def (Str. text (rhs_text pos))]
291291
292292let extra_text text pos items =
293- let pre_extras = rhs_pre_extra_text pos in
294- let post_extras = rhs_post_extra_text pos in
295- text pre_extras @ items @ text post_extras
293+ match items with
294+ | [] ->
295+ let post = rhs_post_text pos in
296+ let post_extras = rhs_post_extra_text pos in
297+ text post @ text post_extras
298+ | _ :: _ ->
299+ let pre_extras = rhs_pre_extra_text pos in
300+ let post_extras = rhs_post_extra_text pos in
301+ text pre_extras @ items @ text post_extras
296302
297303let extra_str pos items = extra_text Str. text pos items
298304let extra_sig pos items = extra_text Sig. text pos items
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments