Skip to content

document concatenates consecutive variants and labels #1983

@liam923

Description

@liam923

The "document" command sometimes concatenates documentation for consecutive entries of variants or records. Here's a cram test that demonstrates:

  $ document_pos () {
  >   pos="$1"
  >   ocamlmerlin single document -position "$pos" < test.ml | jq .value -r
  > }

  $ cat > test.ml <<EOF
  > type variant =
  >   | A (** A *)
  >   | B (** B *)
  >   | C (** C *)
  > 
  > type record =
  >   { e : int (** e *)
  >   ; f : int (** f *)
  >   ; g : int (** g *)
  >   }
  > 
  > let _ = A, B, C
  > let _f x = x.e, x.f, x.g
  > EOF

Get doc for A
# TODO: this should just be "A"
  $ document_pos 12:9
  A
  B

Get doc for B
# TODO: this should just be "B"
  $ document_pos 12:12
  B
  C

Get doc for C
  $ document_pos 12:15
  C

Get doc for e
# TODO: this should just be "e"
  $ document_pos 13:14
  e
  f

Get doc for f
# TODO: this should just be "f"
  $ document_pos 13:19
  e
  f
  g

Get doc for g
# TODO: this should just be "g"
  $ document_pos 13:24
  f
  g

  $ cat > test.ml <<EOF
  > type variant =
  >   | A
  >   (** A *)
  >   | B
  >   (** B *)
  >   | C
  >   (** C *)
  > 
  > type record =
  >   { e : int
  >     (** e *)
  >   ; f : int
  >     (** f *)
  >   ; g : int
  >     (** g *)
  >   }
  > 
  > let _ = A, B, C
  > let _f x = x.e, x.f, x.g
  > EOF

Get doc for A
  $ document_pos 18:9
  A

Get doc for B
  $ document_pos 18:12
  B

Get doc for C
  $ document_pos 18:15
  C

Get doc for e
  $ document_pos 19:14
  e

Get doc for f
# TODO: this should just be "f"
  $ document_pos 19:19
  e
  f

Get doc for g
# TODO: this should just be "g"
  $ document_pos 19:24
  f
  g

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions