Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"editor.formatOnSave": false doesn't appear to be respected #303

Open
rmtsrc opened this issue Oct 19, 2022 · 3 comments · May be fixed by #344
Open

"editor.formatOnSave": false doesn't appear to be respected #303

rmtsrc opened this issue Oct 19, 2022 · 3 comments · May be fixed by #344

Comments

@rmtsrc
Copy link

rmtsrc commented Oct 19, 2022

In my project workspace settings file .vscode/settings.json I have:

{
  "editor.formatOnSave": true,
  "[shellscript]": {
    "editor.formatOnSave": false
  }
}

However, when I save a shell script it's still auto formatted.

As a workaround, to stop auto formatting on shell scripts in my project I have to add all supported file types except for shellscript to:

{
  "shellformat.effectLanguages": [
    "dockerfile",
    "dotenv",
    "hosts",
    "jvmoptions",
    "ignore",
    "gitignore",
    "properties",
    "spring-boot-properties",
    "azcli",
    "bats"
  ]
}

It would be good if this extension also respected the standard VSCode editor.formatOnSave setting.

@rmtsrc rmtsrc changed the title "editor.formatOnSave": false doesn't appear to be supported "editor.formatOnSave": false doesn't appear to be respected Oct 19, 2022
@soredake
Copy link

Reported the same in vscode repo microsoft/vscode#173689

yutotnh added a commit to yutotnh/vs-shell-format that referenced this issue Jul 20, 2023
Changed `editor.formatOnSave` from true to false, but still formatted.
@yutotnh yutotnh linked a pull request Jul 20, 2023 that will close this issue
@foxundermoon foxundermoon self-assigned this Jul 20, 2023
@foxundermoon
Copy link
Owner

The early implementation is not elegant enough, it seems that it needs to be re-architected.
https://code.visualstudio.com/blogs/2016/11/15/formatters-best-practices#_the-formatting-api

@trinitronx
Copy link

This would be a very nice to have feature, as it would allow for configurations like other formatters & linters:

    "[shellscript]": {
      "files.eol": "\n",
      "editor.formatOnSave": true,
      "editor.codeActionsOnSave": {
        "source.fixAll.shellcheck": "explicit"
      },
      "editor.defaultFormatter": "foxundermoon.shell-format"
    }

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

Successfully merging a pull request may close this issue.

4 participants