-
Notifications
You must be signed in to change notification settings - Fork 440
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
Use google-format-code instead of eclipse ? #663
Comments
Take a look at eclipse-jdtls/eclipse.jdt.ls#640 I think it provides what you need. |
@gorkem Yeah unfortunately even using like: { The style is still different than what I get when I run google-format-code :( |
@hexa00 Try to add:
|
@snjeza Thanks but no luck it's like eclipse will format: Like this:
But google-format-code will do:
|
I think Eclipse formatter does not have an option to insert newline before '.' references. |
@gorkem The main problem is that there's a delay to between the save and reload of the formatted code in vscode. So if I save and continue to type then I have modifications that are not in the reloaded file causing vscode to prompt me to compare the unsaved buffer and the reload file. It can get quite annoying :( |
I think embed google-java-format into language server will be the best option. Just like the IntelliJ IDEA's google-java-format plugin did. |
Bumping because Google released binary versions of google-java-format this week. Not sure if they are useful to this extension (the binaries are huge). But for future readers, you can just download the binary and put it on PATH (rename it to Example config: // settings.json
{
"emeraldwalk.runonsave": {
"commands": [
{
"match": ".java$",
"cmd": "google-java-format --replace ${file}"
}
]
}
} |
Is there a way to use google-format-code instead of the eclipse formatter with vscode-java ?
At the moment i'm forced to use it with the SaveAndRun extension, but this has issues like me doing changes while the file is saved and having to reconcile the buffer as it tries to reload.
I could work on a PR for this if you give a few stating points on how to implement this, it would help ?
Thanks,
The text was updated successfully, but these errors were encountered: