Closed RensDimmendaal closed 5 years ago
The majority of the replacement tokens that the extension supports are based on single files, so running 1 command for multiple files would represent a significant change to the api. https://github.com/emeraldwalk/vscode-runonsave#placeholder-tokens
This is not something I plan to support.
I think the other challenge is that VS Code doesn't have an event for save-all.
I believe it does:
It doesn't really matter though because the issue is closed for another good reason :-)
No, I know. I was looking into it cause I thought I could make the code changes myself and either submit a PR or fork this project.
And yes, I see it is possible to save all but I don't see an event for it in the API documentation: https://code.visualstudio.com/api/references/vscode-api. I wouldn't mind writing the code myself -- would give me an opportunity to learn TS, but if VS doesn't expose an event for it then no dice...
One thing that might work would be to only save if event originates from active file. Haven’t looked into it, but I suspect it’s possible and would allow keeping the semantics of single file saves. It would need to be an optional feature though since saving all files is desirable in some scenarios. Probably not something I’ll implement but might be of interest to those experimenting.
I submitted a FR to VS Code for a save-all trigger but it doesn't sound like they will add it. So, my next thought is to either write my own extension or modify this one to, upon save event, see if there are any dirty files and then, if not, run another function/command. If you have 10 dirty files and save, it will trigger the save event for all of them but only for the last save will there no longer be dirty files. I don't know Typescript so this will take me a while...
Currently, if I run the "File: Save All" , run-on-save fires off as many files are being saved. I would like it to only run once.