Skip to content

Making any changes to eclipse formatter xml is not reflecting to actual format of java file #2738

Open

Description

@SunnyRaj84348
Environment
  • Operating System: Arch Linux x86_64
  • JDK version: openjdk 18.0.2 2022-07-19
  • Visual Studio Code version: 1.72.1
  • Java extension version: v1.11.0
Steps To Reproduce
  1. Make sure "java.format.settings.url" is pointing to correct eclipse formatter xml
  2. Make any changes to the eclipse formatter xml
  3. Reload/Restart vscode and format the file
  4. File will get formatted but new changes will be not reflected
Current Result

FIle is formatted but irrespective of changes made in eclipse formatter xml.

Expected Result

File should be formatted with respect to the changes made in eclipse formatter xml.

Additional Informations

This is happening since v1.11.0, version < 1.11.0 have no such issues.

Activity

  1. tthornton3-chwy commented on Oct 13, 2022

    @tthornton3-chwy

    Thanks @SunnyRaj84348 , I was about to report the same!

    The reason (seems to be) because the formatter.xml contents essentially gets put into the org.eclipse.jdt.core.prefs file now on first rebuild, and those take precedence (they didn't previously do this). And updates to formatter.xml do not put the changes back into said file.
    You can remove all of the org.eclipse.jdt.core.formatter. lines within org.eclipse.jdt.core.prefs and it'll work as expected again, but those lines will come back on on rebuild.

  2. snjeza commented on Oct 26, 2022

    @snjeza
    Collaborator

    @SunnyRaj84348 @tthornton3-chwy Could you try VS Code pre-release?

  3. tthornton3-chwy commented on Oct 28, 2022

    @tthornton3-chwy

    @snjeza I believe that did it, thank you!! @SunnyRaj84348 resolved on your end too? It's worth mentioning to start fresh, I cleaned out all of the org.eclipse.jdt.core.formatter. lines myself from the within org.eclipse.jdt.core.pref, cleaned the workspace, and from then on out whatever was in my formatter.xml was what got used (And 'rebuilding' did not bring them back) I don't know if those lines would've cleared themselves out, nor if they were there if they would've been "ignored" for what's in the xml.

    Thanks again for your time here!

  4. sjhobson commented on Nov 29, 2022

    @sjhobson

    I had the same problem as @SunnyRaj84348. I have a custom formatter.xml file that I edit using Eclipse and then copy into my vs code project folder, but the formatting wasn't updating.

    Updating to vscode-java pre-release did not fix it for me, but @tthornton3-chwy's solution of clearing out org.eclipse.jdt.core.formatter.* lines from .settings/org.eclipse.jdt.core.pref did, and my formatter settings take effect now. It's also worth mentioning that if you have a multi module project (as I do via maven), you'll also need to check each module subfolder for .settings/org.eclipse.jdt.core.pref and clear out the org.eclipse.jdt.core.formatter.* lines there as well.

    Thank you all for your help.

  5. zrovihr commented on Jan 18, 2026

    @zrovihr

    this still a thing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions