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

Unable to off the auto format

Open yell0w4x opened this issue 9 months ago • 3 comments

In my .devcontainer/devcontainer.json I have "editor.formatOnSave": true, but I want to disable auto format on save for this particular workspace. So in my .vscode/settings.json I have these

{
    ...
    "editor.formatOnSave": false,
    "[java]": {
        "editor.defaultFormatter": null,
        "editor.formatOnSave": false
    },
    "java.format.enabled": false,
    "java.format.onType.enabled": false,
    "java.format.settings.url": "",
    "java.format.settings.profile": ""
}

As you can see I tried everything I think relates to the issue, but nothing actually works. The plugin continues formatting .java files on save. Only if I disable the plugin it stops.

I also tried to set "editor.formatOnSave": false in devcontainer.json it doesn't matter as well. Please also note I tried only "java.format.enabled": false option leaving "java.format.settings.url" & "java.format.settings.profile" default.

Environment
  • Plugin Version: 1.40.0
  • OS: Manjaro Linux
  • Dev Container OS: Ubuntu 24.04 LTS
  • Java: openjdk version "21.0.6" 2025-01-21

yell0w4x avatar Mar 13 '25 11:03 yell0w4x

What other extensions do you have installed ? If you bring up Format Document With.. (editor.action.formatDocument.multiple) from the command palette, is the only formatter you see the "Language Support For Java" ?

Can you give an example of what is being formatted/changed ? What parts of the file are being modified before/after the format ? I think we have a few options that are independent of the editor.formatOnSave option, like java.saveActions.cleanup, and java.saveActions.organizeImports, but if you aren't setting those to anything, the only one that might apply by default is your file may be renamed to match the primary type if there is a mismatch.

rgrunber avatar Mar 13 '25 14:03 rgrunber

This issue has been closed automatically because it needs more information and has not had recent activity. Please reach out if you have or find the answers we need so that we can investigate further.

github-actions[bot] avatar Apr 13 '25 10:04 github-actions[bot]

I haven't tried to properly reproduce this so I don't mind keeping it open until I can do that and see the behaviour for myself

rgrunber avatar Apr 14 '25 13:04 rgrunber