pucelle / vscode-run-on-save

Run configured shell commands when a file is saved in vscode, and output configured messages on status bar.
https://marketplace.visualstudio.com/items?itemName=pucelle.run-on-save
MIT License
50 stars 11 forks source link

[Feature Request] Add on before save event #7

Closed JCKodel closed 3 years ago

JCKodel commented 4 years ago

My intention is to run dart-import.fix command (that will fix some inconsistencies and sort imports). The way it is it works, but it saves, then fix the imports (so the file remains dirty).

It would be awesome if we could do exactly the same, but using the event onWillSaveTextDocument instead of onDidSaveTextDocument (so the import is run before the save).

A simple option like runBeforeSave: true and just change https://github.com/pucelle/vscode-run-on-save/blob/0b51ed7c9c3a961bd50f7e254a2bf9be6e56a5aa/src/extension.ts#L21 accordingly.

pucelle commented 4 years ago

Sounds good and reasonable, I will extend the plugin later and add configuration items to support it.