-
Notifications
You must be signed in to change notification settings - Fork 30.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Start Debugging" is auto-saving open files even for unchanged files #21681
Comments
@isidorn I suggest you add a breakpoint here to find out why it saves, the reasons are explained in that location: https://github.com/Microsoft/vscode/blob/master/src/vs/workbench/services/textfile/common/textFileEditorModel.ts#L600 |
Another case where a save can cause something to happen is when a save participant is installed that wants to change the file (even if it is not dirty). |
This issue has broken my incremental build feature. Saving clean files when launching a debug session is not a good idea. Like many designs, my debugger tests whether a rebuild is necessary by comparing the file times of the source files with the file times of the output. If the source files are newer, a rebuild is necessary. Performing a save on every debug session causes the source files to have a later timestamp, forcing a rebuild every time. Can you revert this back to the original behaviour. |
Also not sure if it's related, but now nodemon restart the server when I start to debug. The net result is that I get a timeout error everytime now (related bug #21783) |
@bpasero what changed is that now I am explictly calling the @adelphes @alemhnan @spacem yes, we will revert back to the original behavior and you can pick up the fix in tomorrow's vscode insiders. |
@bpasero sounds good to me. I can look into it later tonight. |
@bpasero I introduced a new Save if Dirty action, currently I registered as a regular action so it appears in the command palette which I am not sure is the best. Adding candidate label to discuss if this should be a candidate in tomorrow's standup. @adelphes @alemhnan @spacem tomorrow's insiders will contain the fix for the issue. Can you please try it out. Thanks |
Sorry I do not know what you mean by "tomorrow's insiders". I did a "check for updates" and it said none were found. One thing which maybe is a different issue is I tried just closing all my open windows and starting debug. This didn't save any files however it gives the error "Attach to process: '${command.PickProcess}' doesn't look like a process id.". |
@isidorn good point, alternatively we could introduce a command with "_" to exclude it from the F1 list until someone asks for it. |
@spacem VS Code also has an insiders version which updates every day. You can get it from here http://code.visualstudio.com/docs/?dv=win&build=insiders @bpasero I will remove the '...' from the label of the command - 3448016 |
Tested with today's insider build... ...and it works. It no longer saves clean files when launching a debug session. A slightly confusing behaviour linked to this is that if you have multiple dirty files open, only the currently active editor is saved when debugging is started. Is this expected? |
@adelphes good point. Looking into that I figured out that a neater solution is to simply call 'workbench.action.files.saveAll' action that does everything correctly. Saves all and does not force a write. I have pushed this and will be available in tomorrow's insiders. It will also be availble in VSCode stable some time next week. fyi @bpasero |
Now when I have an untitled file open, it brings up a save dialog every time I start debugging. I frequently use untitled files as scratch pads, so this is annoying. How about |
@isidorn you can use |
@roblourens this feature was about being able to debug untitiled files #19415. Let's wait if somebody else complains other than Rob and we can look into improving this. ATM treating this as designed behavior |
Ok, I'll get someone else to complain about it :) It's really annoying... |
Verified neither the current nor another file get an updated modification timestamp unless they are dirty when starting to debug. |
Like Ben suggested, calling We could also remove that call to not save at all when starting to debug, and assume that people will use autosave if they want it to save there. |
Having talked with @Tyriar about his use of the dirty state I'd vote for not saving at all. Auto-save can be used when not interested in managing the dirty state manually. (Disclaimer: I'm using auto-save.) |
@isidorn to preserve most of the behaviour we want and NOT trigger the "save even if not dirty", I suggest you bring back the action we had in the first place which is to subclass the save action and not force it to save unless the file is dirty. To make this impact minimal, I suggest to register the action in the same way we do it for SaveFilesAction in https://github.com/Microsoft/vscode/blob/master/src/vs/workbench/parts/files/browser/fileActions.contribution.ts#L215 so that it does not show up in the F1 list. |
Now we are only saving the current active file if not dirty before debugging, which is a slight change as to what we were doing before but I think it makes a lot of sense overall. We will trigger new builds after standup since there are other potential candidates to discuss. |
After discussions we have decided to go back to the old behavior we were doing in the previous releases. We are saving all untitiled non dirty files before debug starts. @bpasero please code review and verify |
Since updating today now when I try debugging visual studio codes saves the active file (even though it already is saved) this causes my gulp script to see the change and rebuild/restart node which means node does not show up in the attach to process list. I have "files.autoSave": "off" in my config.
Steps to Reproduce:
The text was updated successfully, but these errors were encountered: