google-java-format
google-java-format copied to clipboard
Reformats Java source code to comply with Google Java Style.
I have a very simple example where google-java-format errors: ``` class Problem { static String problematic() { return """ A too long string directly before the ending triple quote seems...
Desired : ``` if(something) doSomething() ``` Formatter updates it to : ``` if(something) doSomething() ```
This is a follow up to #960 - occasionally the imports are left unformatted and it can be annoying.
Eclipse drop in downloaded from 1.16.0 does not format long line of "throws" like the command line
Eclipse drop in downloaded from 1.16.0 does not format long line of "throws" like the command line. And I don't see a command line option to make it format like...
When formatting files with `google-java-format`, the parser uses the same source version as its own runtime version (running `google-java-format` on JDK X implies that that Java source files are conformant...
I'm trying this out in chromium codebase, and besides the known-issue of excessive lambda whitespace (issue #19), I'm finding the most jarring thing is odd whitespace for variable assignments. google-java-format...
```java java.lang.AssertionError: File text mismatch: tree.length=1574; psi.length=1586; this=PsiJavaFile:_01_demo.java; vp=com.intellij.psi.SingleRootFileViewProvider{vFile=LightVirtualFile: /_01_demo.java, content=VirtualFileContent{size=1464}, eventSystemEnabled=false} at com.intellij.psi.impl.source.PsiFileImpl.getText(PsiFileImpl.java:313) at com.intellij.psi.formatter.FormattingDocumentModelImpl.getDocumentForNonPhysicalFile(FormattingDocumentModelImpl.java:78) at com.intellij.psi.formatter.FormattingDocumentModelImpl.getDocumentToBeUsedFor(FormattingDocumentModelImpl.java:61) at com.intellij.psi.formatter.FormattingDocumentModelImpl.createOn(FormattingDocumentModelImpl.java:41) at com.intellij.lang.java.JavaFormattingModelBuilder.createModel(JavaFormattingModelBuilder.java:41) at com.intellij.formatting.CoreFormatterUtil.buildModel(CoreFormatterUtil.java:30) at com.intellij.psi.impl.source.codeStyle.CodeFormatterFacade.processText(CodeFormatterFacade.java:179) at com.intellij.formatting.service.CoreFormattingService.formatRanges(CoreFormattingService.java:63) at com.intellij.psi.impl.source.PostprocessReformattingAspectImpl$ReformatRangesAction.execute(PostprocessReformattingAspectImpl.java:814)...
The following program with a zero width space after the `println` is executable but cannot not be formatted ``` public class Main { public static void main(String[] args) { System.out.println("hello");...
Trunk Check has a plugin for `google-java-format` which can be enabled by running: ``` trunk check enable google-java-format ```
Putting that: ```java /* * Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,...