Skip to content

Trailing comments getting duplicated #321

Closed
@BalmungSan

Description

Hello, I am getting a funny behavior with comments at the end of a line.

For example, consider this:

```scala mdoc:compile-only
// a
val a = 10
val b = 20 // b
val c = 30
```

It produces this:

```scala
// a
val a = 10
val b = 20 // b // b
val c = 30
```

You can see that the // b comment was duplicated.
Also, without the compile-only modifier this happens:

```scala
// a
val a = 10
// a: Int = 10
val b = 20 // b
// b: Int = 20 // b
val c = 30
// c: Int = 30
```

After playing with it for a while, it seems it only happens with comments at the end of a line, since // a wasn't affected.
And that it requires more statements after; if it is the last one the error doesn't happen (but it may be any arbitrary number of blank lines between b and c).

Using mdoc v2.1.1 through sbt-microsite 1.1.5

Metadata

Assignees

No one assigned

    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