vscode-java icon indicating copy to clipboard operation
vscode-java copied to clipboard

Formatter settings not updated after edit

Open ghost opened this issue 7 years ago • 6 comments

I edited a custom Eclipse formatter file so that brackets are on the same line for classes, methods, etc, and I have it added to my user settings json as:

"java.format.settings.url": "/Users/zeturk/Dropbox/MyEclipse.xml"

MyEclipse.xml file: https://pastebin.com/raw/YvTtsMVW

but when I go back to a project and format the code, it is not updated to the settings specified (even if I reload or completely restart VSCode).

Any help is appreciated! (Sorry if this is an easy fix, pretty new to VSCode)

Environment
  • Operating System: MacOS

ghost avatar Oct 28 '18 06:10 ghost

I can't reproduce the issue. Could you check your workspace settings (<your_project>/.vscode/settings.json)?

snjeza avatar Oct 29 '18 17:10 snjeza

{
   "editor.tabSize": 3,
   "python.pythonPath": "/usr/local/bin/python3",
   "java.format.settings.url": "/Users/zeturk/Dropbox/MyEclipse.xml",
}

This is my workspace settings, and I have the formatter setting added to my user settings too.

ghost avatar Oct 29 '18 17:10 ghost

Could you attach your log (the contents of the Output view)?

snjeza avatar Oct 29 '18 18:10 snjeza

Which log do you need? It looks empty to me

ghost avatar Oct 29 '18 18:10 ghost

See https://github.com/redhat-developer/vscode-java/issues/689#issuecomment-433989545

snjeza avatar Oct 29 '18 19:10 snjeza

I am also seeing this issue now.

When you set "java.format.settings.url" to a local file, and then update the one of the settings in the xml file, the formatter doesn't pick that individual change up. Try changing one of settings in the xml file like:

<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="150"/>

and then reformatting a java file. The line split won't change.

However, if you create a totally new xml file and then point the "java.format.settings.url" to the new file, the new lineSplit will be used when you reformat next time. Hope that helps

dlandis avatar Nov 23 '20 19:11 dlandis