code style (and auto formatting) not working [message #1858404] |
Sat, 01 April 2023 00:51  |
Eclipse User |
|
|
|
Hello, I cannot get even the simplest code style to work.
A simple test: Java > Code Style > Edit default eclipse style > Set indentation to 8 > save under different name > edit java and apply (ctrl+shift+f)
or with:
Set Java > Editor > Actions > Format all code on save
if I insert multiple spaces between tokens, they get collapsed -- so some code cleanup clearly happens, but not the "code formatting"
I tried Eclipse 20230-3, 2022-?? -- updated everything; played with profiles. This is on Ubuntu with Amazon corretto, made a fresh install - but used the same workspace...
I can't find any errors in the error.log; eclipse verbose output is no revealing anything (to me at least), been at it for the past few hours and am really stuck. Would appreciate a nudge in the right direction.
[Updated on: Sat, 01 April 2023 00:52] by Moderator Report message to a moderator
|
|
|
|
|
Re: code style (and auto formatting) not working [message #1858427 is a reply to message #1858418] |
Sun, 02 April 2023 17:52  |
Eclipse User |
|
|
|
Unfortunately, I got trapped by this: https://github.com/google/styleguide/issues/687 -- eclipse formatter + google style produce vastly different results from `google-java-format` plugin. E.g. method parameters are not on separate lines.
On top of that, the plugin was not working (activated) in the recent Eclipse -- no errors; I figured that out only after trying with an older eclipse - which produced the error.
this needs to be passed (eclipse.ini)
```
--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED
--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED
--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED
--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED
--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED
--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
```
so three problems conspired to make my life miserable
|
|
|
Powered by
FUDForum. Page generated in 0.02872 seconds