Skip to content

Doc comments are associated with the wrong constructors #1513

@mheiber

Description

@mheiber

Steps to rero

Create foo.ml, with these contents:

type t =
    | A
    (**A Comment *)
    | B
    (**B Comment *)
    | C

Then open the file in VSCode, using the Ocaml Platform extension (tested with v1.10.7), which I think uses Merlin v4.6-413 via ocaml-lsp-server.

Hover over each constructor

Actual behavior

Here are the hovers ocaml-lsp-server provides for each constructor, respectively:

  • A: "A comment"
  • B: "A comment B comment"
  • C: "B comment"

Expected behavior

Here are the hovers I'd expect ocaml-lsp-server to provide for each constructor, respectively:

  • A: "A comment"
  • B: "B comment"
  • C: "C comment"

This expectation is based on the OCaml manual https://v2.ocaml.org/manual/doccomments.html#ss:label-comments:

Comments which appear immediately after a labelled argument, record field, variant constructor, object method or polymorphic variant constructor are are converted into attributes.

version

I used ocaml-lsp-server.1.13.2~5.0preview which I think uses Merlin v4.6-413

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions