Tom-Bonnike / vscode-formatting-toggle

A VS Code extension that allows you to toggle the formatter (Prettier, Beautify, …) ON and OFF with a simple click.
https://marketplace.visualstudio.com/items?itemName=tombonnike.vscode-status-bar-format-toggle
MIT License
60 stars 13 forks source link

Doesn't overwrite workspace settings #36

Closed peterp closed 6 years ago

peterp commented 6 years ago

This extension doesn't work as intended when you've got workspace settings.

Tom-Bonnike commented 6 years ago

Thanks @peterp. I’ll check that as soon as I have time.

Tom-Bonnike commented 6 years ago

@peterp can you describe the exact issue you’re facing? I don’t think I’ll be able to override workspace settings:

From my understanding there’s three possible cases: 1) Your workspace settings enable the formatter ➡️ you can use your formatter accross the whole project and you probably don’t want to disable it. 2) Your workspace settings disable the formatter ➡️ you shouldn’t be using your formatter so you have no reason to want to enable it. 3) Your workspace settings don’t impact any formatting settings :arrow_right: your user settings (which this extension modifies) will be used instead, so the extension should work fine.

I don’t think VSCode provides a way to ignore the workspace settings file (or specific rules inside of it).

peterp commented 6 years ago

Hey @Tom-Bonnike,

We have some files that are formatted and some files that aren't yet... so I want to be able to toggle the formatter for those file.

You explanation makes sense, I didn't realise that it was modifying the configuration files, this is what is in my workspace settings:

{ 
"[javascript]": {
    "editor.formatOnPaste": true,
    "editor.formatOnSave": true,
    "editor.formatOnType": false,
    "editor.tabSize": 2,
  },
  "files.trimTrailingWhitespace": true,
  "prettier.eslintIntegration": true,
}
Tom-Bonnike commented 6 years ago

Ah, yeah… I don’t think I’ll be able to do anything about that, sorry. But I’m pretty sure you could use .prettierignore files: https://prettier.io/docs/en/ignore.html for that? The Prettier extension respects those settings :)

peterp commented 6 years ago

Thanks!