Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: adjust text block indentation #596

Merged

Conversation

jtkiesel
Copy link
Contributor

@jtkiesel jtkiesel commented Aug 6, 2023

What changed with this PR:

Text blocks are now split by lines when printing, with the "base indentation" removed, so that they are indented more logically by Prettier.

Example

Input

class Example {

  void example() {
    System.out.println(
      // leading comment
        """
               abaoeu
                 euaoeu
              aoeu

               oaeu
                    abc""" // trailing comment
    );

    System.out.println(
        """
 abaoeu
   euaoeu
aoeu

 oaeu
      abc"""
    );
  }
}

Output

class Example {

  void example() {
    System.out.println(
      // leading comment
      """
       abaoeu
         euaoeu
      aoeu

       oaeu
            abc""" // trailing comment
    );

    System.out.println(
      """
       abaoeu
         euaoeu
      aoeu

       oaeu
            abc"""
    );
  }
}

Relative issues or prs:

Closes #593

@clementdessoude
Copy link
Contributor

Thanks again @jtkiesel ! I just have one comment, but the logic seems ok otherwise :)

@jtkiesel jtkiesel force-pushed the feat/adjust-text-block-indentation branch from bfb3be1 to 6258570 Compare August 12, 2023 16:49
@DanielFran DanielFran added $100 https://www.jhipster.tech/bug-bounties/ $$ bug-bounty $$ https://www.jhipster.tech/bug-bounties/ labels Aug 12, 2023
@clementdessoude clementdessoude merged commit 9f2687d into jhipster:main Aug 15, 2023
7 checks passed
@jtkiesel jtkiesel deleted the feat/adjust-text-block-indentation branch August 16, 2023 02:15
@jtkiesel
Copy link
Contributor Author

@DanielFran
Copy link
Member

@jtkiesel approved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
$$ bug-bounty $$ https://www.jhipster.tech/bug-bounties/ $100 https://www.jhipster.tech/bug-bounties/
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adjust indentation of multiline string
3 participants