Skip to content

Prompt to save untitled file before run/debug #111850

Closed

Description

Follow up from #110330, a common issue reported from new users who are just getting into coding is forgetting to save files before running them. This is probably based upon experience with cloud-based text and code editing that provide auto-save and live-refresh for an iterative editing cycle.

A stop gap solution that doesn't require too much thought is to prompt the file-save dialog when the file that the user wants to run is not saved to disk yet. I expect this to not be too surprising and only affect the corner cases of users who accidentally try to run new untitled files.

Related, #111053 is a good precursor, as more new files will have a language mode set from the beginning and therefor a file extension set when saving.

Activity

  1. added
    debug
    on Dec 4, 2020
  2. isidorn commented on Dec 4, 2020

    @isidorn

    Harald Kirschner (@digitarald) thanks for the feedback. But currently we automtically save all files before you start running / debugging. I just checked and this works just fine for me.

    If this does not work for you can you please provide reproducable steps? Thanks!

  3. added
    info-needed
    on Dec 4, 2020
  4. digitarald commented on Dec 4, 2020

    @digitarald
    ContributorAuthor

    This was a theme in user tests, but I should have spend some more time on root cause analysis.

    The core of the scenario is creating an untitled file, which isn't save. The run/debug actions though generally don't work well without a workspace (even less so with an untitled file open), so maybe this is the actual root cause.

  5. isidorn commented on Dec 7, 2020

    @isidorn

    Ok, adding a prompt to save active untitiled file makes good sense.
    Duplicate of #19415

    Benjamin Pasero (@bpasero) is there a better way to save current untitled file appart from executing workbench.action.files.save (that was 3 years ago)?

  6. added
    feature-request
    and removed
    info-needed
    on Dec 7, 2020
  7. bpasero commented on Dec 7, 2020

    @bpasero
    Contributor

    Isidor Nikolic (@isidorn) if you only know the resource, you can also use ITextFileService.save and pass it the resource. Better is to use IEditorService#save passing in the editor to save.

  8. isidorn commented on Dec 7, 2020

    @isidorn

    Benjamin Pasero (@bpasero) thanks, however I just found the includeUntitled flag in the editorService.saveAll so I went with that and it seems to work just fine.
    Harald Kirschner (@digitarald) you can try it out with vscode insiders once we release it end of week and let me know how it works for you. Thanks

  9. added
    unreleased
    on Dec 7, 2020
  10. added
    verification-needed
    on Dec 7, 2020
  11. bpasero commented on Dec 7, 2020

    @bpasero
    Contributor

    Just fyi, I wonder if this may be annoying for users that always carry around some untitled files for notes or just in general. I think it would make more sense to only save untitled files with code that belong to the debug session and not all. How to detect that is a different question though...

  12. isidorn commented on Dec 7, 2020

    @isidorn

    Good point. Let me change it to only do so for the active file, that way it should be better.

  13. added a commit that references this issue on Dec 7, 2020
    cf8ed37
  14. added
    insiders-released
    and removed
    unreleased
    on Dec 11, 2020
  15. locked and limited conversation to collaborators on Jan 22, 2021
  16. isidorn commented on Jan 22, 2021

    @isidorn

    Harald Kirschner (@digitarald) would be cool if you can try this out with vscode insiders and let me know if this works as expected so we can add a verified label

  17. added
    verified
    and removed
    verification-needed
    on Jan 22, 2021
  18. digitarald commented on Jan 22, 2021

    @digitarald
    ContributorAuthor

    Thank you for the ping! Worked as expected for new unsaved file.

  19. added
    verification-needed
    on Jan 25, 2021
  20. isidorn commented on Jan 25, 2021

    @isidorn

    Harald Kirschner (@digitarald) thanks! Also no need to remove the verification-needed label, we just add the verified and the bot gets happy :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

debugfeature-requestinsiders-releasedverification-neededverified

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions