pucelle/vscode-run-on-save

[Feature Request] Add on before save event

JCKodel opened this issue · 1 comments

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

vscode.workspace.onDidSaveTextDocument((document: vscode.TextDocument) => {
accordingly.

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