Java: Ensure Java formatting when editing on VS Code / IntelliJ#1396
Java: Ensure Java formatting when editing on VS Code / IntelliJ#1396brunoborges wants to merge 14 commits intomicrosoft:experimental-javafrom brunoborges:java-format-vscode
Conversation
It uses the Google Java Format command line tool to quickly perform the formatting on save
|
Is the only way to get formatting on vs code to have a jar checked in to the repo? |
Not likely. The plugin/extensions for VSCode likely pull in whatever dependencies you need instead. I'd take a look at |
|
This was the only true cross-platform way to get Google Java Format with AOSP style to work on VS Code. |
|
Commit 47cf4d0 moves the formatting plugin to the general profile of the Maven project. This way, no matter when/how the Maven project is built (command-line, terminal, etc), the code will be formatted. But the VS Code setting is still required as it ensures new code comes with the right formatting, and solves the problem of when a developer adds a Java class without running a build (unlikely, but still...) |
|
We have decided to fix the Meanwhile, IDEs may be configured manually by the developer with the AOSP Google Format style, but that setting doesn't have to be in the repository. We may change the style later, to something that both IntelliJ and VS Code can share certainly (not the case for AOSP). For now, PR authors should definitely build the project with |
This PR enables a Run On Save on VS Code that will format the modified Java code according to the project settings (Google Format with AOSP style).