foxundermoon / vs-shell-format

the shellscript、Dockerfile、properties ...... format extension
MIT License
444 stars 47 forks source link

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

Open rmtsrc opened 1 year ago

rmtsrc commented 1 year ago

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.

soredake commented 1 year ago

Reported the same in vscode repo https://github.com/microsoft/vscode/issues/173689

foxundermoon commented 1 year ago

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 commented 2 months ago

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"
    }