question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Multiline comment formatting not idempotent

See original GitHub issue

I’m seeing an issue with multiline comments getting extra indentation each time they get run through prettier-java

Input:

public class Example {
  
  public void method() {
    /*
      multiline comment
     */
  }
}

Output: (after running prettier ~5 times)

public class Example {

  public void method() {
    /*
                multiline comment
   */
  }
}

Each run of prettier seems to indent the comment a little more.

The issue doesn’t manifest if each line of the comment is prefixed with an asterisk (although the formatting in this case still looks a little bit off), for example:

Input:

public class Example {

  public void method() {
    /*
     * multiline comment
     */
  }
}

Output:

public class Example {

  public void method() {
    /*
   * multiline comment
   */
  }
}

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
jhabercommented, Oct 6, 2019

I also tried running on #278 and got the same result

0reactions
clementdessoudecommented, Oct 7, 2019

Good insight ! That matches what I am thinking after taking a quick look at this issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Set Format Of Multiline Comment in IntelliJ
File > Settings (Ctrl + Alt + S on Windows); Editor > Live Templates; Add a new one or edit an existing one,...
Read more >
Ruby Style Guide
Use only spaces for indentation. No hard tabs. Indentation. Use two spaces per indentation level (aka soft tabs).
Read more >
Using filters to manipulate data - Ansible Documentation
Using filters to manipulate data . Filters let you transform JSON data into YAML data, split a URL to extract the hostname,...
Read more >
Configuration · Scalafmt - Scalameta
Warning: this rewrite might cause non-idempotent formatting, formatter might need to be run twice. This rule cannot be used with rewrite.scala3.
Read more >
RFC 7231: Hypertext Transfer Protocol (HTTP/1.1)
Idempotent Methods A request method is considered "idempotent" if the intended effect ... A standard format for such a representation is not defined...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found