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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

formattingToggle.deactivateFor #47

Closed
Jonas1312 opened this issue Jul 10, 2019 · 6 comments 路 Fixed by #51
Closed

formattingToggle.deactivateFor #47

Jonas1312 opened this issue Jul 10, 2019 · 6 comments 路 Fixed by #51

Comments

@Jonas1312
Copy link

Thanks for your extension 馃檪

That would be nice to have an option formattingToggle.deactivateFor, in my case I would like to disable formatOnSave but keep formatOnPaste and formatOnType when I'm contributing to existing code.

Thanks

@Tom-Bonnike
Copy link
Owner

Hey. Unless I鈥檓 misunderstanding, this is already possible with:

"formattingToggle.activateFor": ["formatOnPaste", "formatOnType"]

@Jonas1312
Copy link
Author

Sorry it wasn't clear.

When I click the "formatting" button your extension disable all three options (formatOnPaste, formatOnType, formatOnSave). I would like to keep formatOnType and formatOnPaste enabled.

If I'm not mistaken "formattingToggle.activateFor" works only when you enable formatting, but it's not possible to control which of the three settings your extension disable

@Tom-Bonnike
Copy link
Owner

Tom-Bonnike commented Jul 10, 2019

Would this work for you?

{
  "editor.formatOnSave": false,
  "editor.formatOnPaste": true,
  "editor.formatOnType": true,
  "formattingToggle.activateFor": ["formatOnPaste", "formatOnType"]
}

I think that should work the way you want it.

@Jonas1312
Copy link
Author

Nope that's not really what I'm looking for

I would like two configurations, that is, two states:

  • State 1: everything on, I use this configuration when I'm working alone on a project, so that all my codes are properly formatted with the same formatter.
  "editor.formatOnSave": true,
  "editor.formatOnPaste": true,
  "editor.formatOnType": true,
  • State 2: everything on except format all document (formatOnSave), which is convenient when contributing to existing code which wasn't properly formatted, and you don't want a minor change to modify the whole file.
  "editor.formatOnSave": false,
  "editor.formatOnPaste": true,
  "editor.formatOnType": true,

I tried your suggestion:

{
  "editor.formatOnSave": false,
  "editor.formatOnPaste": true,
  "editor.formatOnType": true,
  "formattingToggle.activateFor": ["formatOnPaste", "formatOnType"]
}

and the two states it produced are:

  • State 1: toggle formatting off => everything off
  "editor.formatOnSave": false,
  "editor.formatOnPaste": false,
  "editor.formatOnType": false,
  • State 2: toggle formatting on => everything on except format all document (formatOnSave)
  "editor.formatOnSave": false,
  "editor.formatOnPaste": true,
  "editor.formatOnType": true,

@Tom-Bonnike
Copy link
Owner

Tom-Bonnike commented Jul 10, 2019

Oh. I understand now, although I have to admit I dont really see what the actual use-case is (does formatOnType really only format a specific portion of the code?! Prettier only runs on the full file, no?).
The point of this extension is to quickly enable/disable all formatting you want to use. Not allow you to toggle on/off specific settings at different times 馃槄

You might want to look into other extensions such as https://marketplace.visualstudio.com/items?itemName=rebornix.toggle.
I鈥檒l close this, happy to reconsider if more people want something like this, but again I鈥檓 not sure it gives much value.

@Tom-Bonnike
Copy link
Owner

I want to tackle this, moved to #48

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

Successfully merging a pull request may close this issue.

2 participants