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

fix(printer): break and indent binary expression with cast properly #587

Merged

Conversation

jtkiesel
Copy link
Contributor

What changed with this PR:

Assignments containing a binary expression beginning with a cast now break and indent the way Prettier JavaScript does.

Example

Input

public class Test {

  public static void main(String[] args) {
    if (oneLevelDeep) {
      if (twoLevelsDeep) {
        if (threeLevelsDeep) {
          int successfulCount = 0;
          int failureCount = 1;
          double availability = (double) successfulCount / (successfulCount + failureCount);
        }
      }
    }
  }
}

Output

public class Test {

  public static void main(String[] args) {
    if (oneLevelDeep) {
      if (twoLevelsDeep) {
        if (threeLevelsDeep) {
          int successfulCount = 0;
          int failureCount = 1;
          double availability =
            (double) successfulCount / (successfulCount + failureCount);
        }
      }
    }
  }
}

Relative issues or prs:

Fix #396

@jtkiesel jtkiesel force-pushed the fix/break-and-indent-binary-with-cast branch 2 times, most recently from 7f2d64b to 206cb6f Compare July 21, 2023 07:01
@jtkiesel jtkiesel force-pushed the fix/break-and-indent-binary-with-cast branch from 22d656a to d3f7cc3 Compare July 21, 2023 07:05
@clementdessoude clementdessoude merged commit b1b9e7c into jhipster:main Jul 22, 2023
7 checks passed
@jtkiesel jtkiesel deleted the fix/break-and-indent-binary-with-cast branch July 22, 2023 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing indentation for division function
2 participants