vscode-rust icon indicating copy to clipboard operation
vscode-rust copied to clipboard

`actionOnSave` does not trigger when saving and file is clean

Open redactedscribe opened this issue 7 years ago • 8 comments

Version of the extension: 0.3.10

The actionOnSave configuration parameter works only when a file is saved and was also dirty. VS Code now allows you to save manually, even when the file is not dirty.

Running in legacy mode with "rust.executeCargoCommandInTerminal": true.

redactedscribe avatar Mar 03 '17 19:03 redactedscribe

Hello @redactedscribe, I didn't checked that. I will.

KalitaAlexey avatar Mar 04 '17 07:03 KalitaAlexey

In my opinion, the extension behaves correctly now. I don't like the new feature introduced by VSCode. All commands, which are possible to invoke on saving, may be invoked from the command palette. I am inclined to keep the behavior.

I am asking other people to speak up if they disagree.

KalitaAlexey avatar Mar 04 '17 07:03 KalitaAlexey

I disagree. Personally I prefer things like fmt and clippy to run every time I save, including when the file is clean.

mtsr avatar Mar 04 '17 14:03 mtsr

@mtsr, I am not sure if you understand what we are talking about. "A file is clean" means it has no unsaved changes. You still execute any command, format via Right Click.

KalitaAlexey avatar Mar 04 '17 15:03 KalitaAlexey

From my perspective, the parameter is named actionOnSave and therefore should execute when save occurs, no matter if the file is clean. I have found myself often typing a to dirty the file, just to save to trigger a build. It's more convenient than Ctrl+Shift+R/B for me.

redactedscribe avatar Mar 04 '17 17:03 redactedscribe

Okay. If you say so. I will modify code.

KalitaAlexey avatar Mar 04 '17 17:03 KalitaAlexey

@KalitaAlexey I'm in agreement with @mtsr and @redactedscribe here.

To me, actionOnSave in any context is a way to say "When you attempt to save a file, these are the action(s) that will performed prior to saving that file." To put it another way, regardless of whether we agree or not, I can't think of any reason why only triggering on dirty files is better than always triggering.

Commonly used for things like formatters and such, sure, but anyone who uses it to do something like build+run benefits from it triggering on every save, not just dirty saves.

On top of that, triggering on every save has no effect on those of us only using it for formatting, since attempting to format an unchanged file should basically do nothing since our last save would've already formatted it!

joshsleeper avatar Apr 23 '17 22:04 joshsleeper

@joshsleeper, I got the point. I have no time for this. I am going to do this before publishing a new version. I suppose in two days.

KalitaAlexey avatar Apr 24 '17 04:04 KalitaAlexey