Closed moltar closed 4 years ago
Format on save is disable'able. Check the command palate for https://github.com/bcomnes/sublime-standard-format/blob/master/Main.sublime-menu#L74 (Format on Save)
Per project auto enable/disable:
If the plugin can't find standard in its search path, it will not perform a format, even if format-on-save is turned on. You can take advantage of this behavior to automatically enable and disable the plugin. The only requirement is that 'standard' is not installed globally, or you disable the global search path if you require a global install (https://github.com/bcomnes/sublime-standard-format/blob/master/StandardFormat.sublime-settings#L12)
The way you do this is by installing standard as a dev-dependency to projects that you want to be standardized. When you open these projects, if sublime-standard-format finds standard inside the search PATH (including local node_modules/.bin relative to the open file or project), it will try to format the file, if Format on Save is enabled.
Thanks, I was thinking of this solution too. I guess it'd work for now. But still, would be good to have settings per project :)
Where would you suggest the settings live? Package.json? Sublime Project file settings?
Sublime Project settings I think would be best.
I don't use those to much, but you are right, that would be a good addition. I've seen that pattern in VS Code recently.
Closing for now. If someone wants to work on this re-open or recreate.
Use case: some older/legacy projects do not want to be "standardized". Now, I have "format on save" turned on, and it's a global settings. Forgetting to turn it off, when switching to legacy projects, causes a lot of undesirable rewriting to happen.
Would be great to have the ability to disable format on save, and maybe other settings on per-project basis.
Thanks.