Skip to content

#10027 confirmSave should check the goal of running an extension is actually…#76337

Closed
qadram wants to merge 10 commits intomicrosoft:masterfrom
qadram:master
Closed

#10027 confirmSave should check the goal of running an extension is actually…#76337
qadram wants to merge 10 commits intomicrosoft:masterfrom
qadram:master

Conversation

@qadram
Copy link
Contributor

@qadram qadram commented Jun 29, 2019

… to run tests.

@roblourens
Copy link
Member

Is that the right issue? It was closed a long time ago

@qadram
Copy link
Contributor Author

qadram commented Jun 29, 2019

I think it was not correctly closed, as it doesn't solve the problem it was being presented.

Problem: When developing an extension and running such extension using the Extension Development Host, dirty files doesn't prompt to save them. If you are developing an extension that needs such prompt, it's not possible because it was disabled on purpose.

The logic behind my pull request is:

  • If the goal was to prevent VS Code to prompt saving dirty files when running tests
  • Then, skipping such prompt should be done when there are actual tests running
  • And not simply because the Extension Development Host is running, that assumption is simply false

It's subtle, but it's preventing me from using VS Code to run and debug an extension I'm working on because I cannot test all the scenarios as the prompt is not shown, and I'm not running tests, I'm just developing an extension.

Regards

@bpasero bpasero added this to the Backlog milestone Jun 30, 2019
@bpasero
Copy link
Member

bpasero commented Jul 1, 2019

I find the current behaviour work better for this particular use case:

  • I debug an extension and it opens in a window
  • I do a lot of stuff, e.g. open editors, make them dirty
  • when I am done I hit Cmd+Q to close the window

If we would start to prompt for saving changes, we would break this flow. This was one of the main motivations to not ask for saving dirty files initially.

@bpasero bpasero added the info-needed Issue requires more information from poster label Jul 1, 2019
@qadram
Copy link
Contributor Author

qadram commented Jul 1, 2019

I find that behavior very useful when running tests, like it's noted on the comment, but I find weird that the behavior of the product is modified in such an important way for a code editor.

When I noticed my first impression is that such behavior it was a bug, that's why I investigated more and I found, while debugging the code, that it was as designed.

In any case, would be great to add a new switch to the command line (or through another mechanism) to allow users to choose the behavior. That is, the existing behavior won't be modified, but if someone wants the Extension Development Host to ask to save dirty files, there should be a mechanism for that. At this moment, there is no alternative.

In my case, I'm working on an extension that needs to make dirty several files that are related between them, and when closing one of them, different things should happen. If I don't get the prompt, I cannot verify I'm doing things properly.

@qadram
Copy link
Contributor Author

qadram commented Jul 1, 2019

By the way, if the suggestion of adding an extra parameter (or any other way) you think it will be OK, I can work on that direction and send another pull request.

@bpasero
Copy link
Member

bpasero commented Jul 1, 2019

Yes, having an extra parameter works for me. I would not show this prominently though (e.g. in the --help output), rather document it on our extension development page. Is that ok?

@qadram
Copy link
Contributor Author

qadram commented Jul 1, 2019

Sure. Will implement --confirm-save, if present, it will override the existing behavior.

@bpasero
Copy link
Member

bpasero commented Jul 1, 2019

@qadram it needs to have some kind of prefix to make clear it is about extension development right? E.g. --extension-development-confirm-save?

@qadram
Copy link
Contributor Author

qadram commented Jul 1, 2019

Perfect, thanks!

qadram added 2 commits July 2, 2019 12:50
…ting asked to save dirty files when executing an extension
@msftclas
Copy link

msftclas commented Jul 2, 2019

CLA assistant check
All CLA requirements met.

@bpasero
Copy link
Member

bpasero commented Aug 5, 2019

Continues in #78033

@bpasero bpasero closed this Aug 5, 2019
@bpasero bpasero added feature-request Request for new features or functionality verification-needed Verification of issue is requested and removed info-needed Issue requires more information from poster labels Aug 5, 2019
@bpasero bpasero removed this from the Backlog milestone Aug 5, 2019
@bpasero bpasero added this to the August 2019 milestone Aug 5, 2019
@bpasero bpasero removed feature-request Request for new features or functionality verification-needed Verification of issue is requested labels Aug 5, 2019
@github-actions github-actions bot locked and limited conversation to collaborators Mar 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants