You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Prompt to save untitled file before run/debug #111850
debugDebug viewlet, configurations, breakpoints, adapter issuesfeature-requestRequest for new features or functionalityinsiders-releasedPatch has been released in VS Code Insidersverification-neededVerification of issue is requestedverifiedVerification succeeded
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.
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!
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.
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)?
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.
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
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...
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
debugDebug viewlet, configurations, breakpoints, adapter issuesfeature-requestRequest for new features or functionalityinsiders-releasedPatch has been released in VS Code Insidersverification-neededVerification of issue is requestedverifiedVerification succeeded
Activity
isidorn commentedon Dec 4, 2020
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!
digitarald commentedon Dec 4, 2020
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.
isidorn commentedon Dec 7, 2020
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)?bpasero commentedon Dec 7, 2020
Isidor Nikolic (@isidorn) if you only know the resource, you can also use
ITextFileService.saveand pass it the resource. Better is to useIEditorService#savepassing in the editor to save.isidorn commentedon Dec 7, 2020
Benjamin Pasero (@bpasero) thanks, however I just found the
includeUntitledflag in theeditorService.saveAllso 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
bpasero commentedon Dec 7, 2020
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...
isidorn commentedon Dec 7, 2020
Good point. Let me change it to only do so for the active file, that way it should be better.
fixes #111850
isidorn commentedon Jan 22, 2021
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
digitarald commentedon Jan 22, 2021
Thank you for the ping! Worked as expected for new unsaved file.
isidorn commentedon Jan 25, 2021
Harald Kirschner (@digitarald) thanks! Also no need to remove the verification-needed label, we just add the
verifiedand the bot gets happy :)