You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
vscode-extension: Provide an action to open the formatter settings file #2
I wanted to open an enhancement-request to provide a configuration surface for the formatter. Currently I use eclipse, and I would like to move over to vs code. But I do need a way to format the code according to a formatting policy.
Thanks @gorkem. This is a great tool, but unfortunately I cannot use it without the formatter. Over the next few month I'll see if I can learn to contribute to the project :-) In the meantime i would be grateful to know if there are any workarounds...
This is very annoying. We have a specialized eclipse formatting settings but when using visual code I muck that up and there is no documented way to change it. Is there any workaround?
FWIW there is a maven plugin which uses the Eclipse formatter and can use any provided formatting configuration. A native solution would be better of course.
Any news on this? I think this is really important.
Even a property like "java.formater.file" in vscode to point to my global company rules would really help. I don't want to copy the file in all of our projects by hand...
I can recommend the gradle/maven plugin spotless as a work around (https://github.com/diffplug/spotless). Your build tool then makes sure everything is formatted. It can reformat your code automatically via the command spotlessApply. Not a replacement but makes things more tolerable and enforces a single code formatting standard.
After copying the .settings/org.eclipse.jdt.core.prefs file you need to restart vscode for the changes to be picked. It was working for me after restart. 1.21.1 version. However now i have to copy this file to each project to get formatting to work. Is there a global location to place this file?
I would like to see this feature in the next releases. In spite of the workaround works fine, could be great declared in vscode user settings a global ./settings folder to use for each project. Also, for example, org.eclipse.jdt.ui.prefs is needed as well to sort import statements.
Activity
houman-babai commentedon Feb 9, 2017
I wanted to open an enhancement-request to provide a configuration surface for the formatter. Currently I use eclipse, and I would like to move over to vs code. But I do need a way to format the code according to a formatting policy.
Is this ticket addressing the same problem?
gorkem commentedon Feb 9, 2017
@houman-babai Yes, this is a request to use and edit eclipse formatting policies
houman-babai commentedon Feb 9, 2017
Thanks @gorkem. This is a great tool, but unfortunately I cannot use it without the formatter. Over the next few month I'll see if I can learn to contribute to the project :-) In the meantime i would be grateful to know if there are any workarounds...
concatime commentedon Mar 19, 2017
I would love to see it in future releases too!
bowiegou commentedon Mar 26, 2017
Yes. please have this feature.
Dangoo commentedon Apr 5, 2017
I'd vote for that too!
@gorkem any hints where one could find the configuration for formating-rule, might find some time to contribute…
magnusart commentedon Jul 7, 2017
This is very annoying. We have a specialized eclipse formatting settings but when using visual code I muck that up and there is no documented way to change it. Is there any workaround?
musiKk commentedon Jan 25, 2018
FWIW there is a maven plugin which uses the Eclipse formatter and can use any provided formatting configuration. A native solution would be better of course.
KaRkY commentedon Feb 19, 2018
What is teh status of the issue?
It is the only thing preventing me from using this instead of eclipse proper.
DiabolusExMachina commentedon Feb 23, 2018
Any news on this? I think this is really important.
Even a property like "java.formater.file" in vscode to point to my global company rules would really help. I don't want to copy the file in all of our projects by hand...
fbricon commentedon Feb 23, 2018
Sorry guys, there's been no new development in that area yet. As a workaround for your formatting options, please read https://github.com/redhat-developer/vscode-java/wiki/Formatter-settings
subpandu commentedon Feb 26, 2018
Trying to use the given workaround, how do you tell vscode to pick the formatting rules from .settings/org.eclipse.jdt.core.prefs
Just including the file in the project did not work
DiabolusExMachina commentedon Feb 28, 2018
Yes moving the file to the .settings folder does not seem to work
magnusart commentedon Feb 28, 2018
I can recommend the gradle/maven plugin
spotlessas a work around (https://github.com/diffplug/spotless). Your build tool then makes sure everything is formatted. It can reformat your code automatically via the command spotlessApply. Not a replacement but makes things more tolerable and enforces a single code formatting standard.fbricon commentedon Feb 28, 2018
can anyone provide a sample project where .settings/org.eclipse.jdt.core.prefs are ignored?
gitorko commentedon Mar 23, 2018
After copying the .settings/org.eclipse.jdt.core.prefs file you need to restart vscode for the changes to be picked. It was working for me after restart. 1.21.1 version. However now i have to copy this file to each project to get formatting to work. Is there a global location to place this file?
angelfraga commentedon Apr 6, 2018
I would like to see this feature in the next releases. In spite of the workaround works fine, could be great declared in vscode user settings a global ./settings folder to use for each project. Also, for example, org.eclipse.jdt.ui.prefs is needed as well to sort import statements.