skip to Main Content

I am looking for a way so that vscode will format my java code such that curly braces are on separate lines. For example…

if(x)
{
  dosomething();
}
else
{
  dosomethingelse();
}

I’ve tried installing Java prettier format and Language Support for Java Red Hat, and neither of those seem to help.

2

Answers


  1. IDE Eclipse has template for Java code format there on e can change for desired style. Similarly for VS code also it should have template and changing template should give required effect

    Login or Signup to reply.
  2. You can use the Java: Open Java Formatter Settings with Preview. command to open the format settings preview window for modification.

    enter image description here

    More detailed settings can be read here.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search