Vscode: Don't save all "dirty editors" when a task is executed

Created on 2 Apr 2020  路  5Comments  路  Source: microsoft/vscode



The Problem

When I have multiple editors with changes open and I invoke a task (like the default build/test task) all editors are automatically saved before the task is executed. Sometimes this causes my test run to fail because the other files are not yet ready to be tested, they are still a work in progress. Other times I simply want to compile my current file to see if it actually compiles against the rest of the project, only to discover that my other pending changes have been saved to disk as well and they now break the compilation for a myriad of reasons (syntax errors, unfinished implementations etc.).

This forces me to either painfully stash away the unwanted changes and run the task again or keep "flying blind" until I make the codebase fully functional again.

The solution

I would love to have some control over that autosave-on-task-run functionality. I was unable to find anything relevant in Settings or task definitions.

Option 1

Ask me each time I run a task with other "dirty" editors to either save them or run as-is.

Option 2

Add a configuration option/checkbox to specify ahead of time whether to save any dirty editors before task runs or to simply run them straight away.

Option 3

Allow a task definition to control this mechanism through a flag (via _tasks.json_).

I think I like the option 1 and option 2 the most.
Thank you for considering this! 鉂わ笍

feature-request good first issue help wanted on-testplan tasks

Most helpful comment

Hey, I've taken the liberty of opening a PR adding the specs that @robertrossmann suggested, hopefully, makes sense.

Helping OSS on quarantine is the way to go!

All 5 comments

(Experimental duplicate detection)
Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

I would like to take a look at resolving this

It just occurred to me that perhaps the best UX to address this problem would be a multiple-choice setting where the user can specify which of the proposed actions should be taken when a task is run with dirty editors open. The options would be

  • save all and run
  • run without saving
  • prompt each time

Would that also be fair game for a PR? 馃

Hey, I've taken the liberty of opening a PR adding the specs that @robertrossmann suggested, hopefully, makes sense.

Helping OSS on quarantine is the way to go!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Brakkar picture Brakkar  路  364Comments

Tekbr picture Tekbr  路  191Comments

misolori picture misolori  路  282Comments

hsdk123 picture hsdk123  路  263Comments

jez9999 picture jez9999  路  234Comments