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
onDidSaveTextDocument event does not fire when saving a non-dirty file #66338
Comments
(Experimental duplicate detection) |
Have to check if it makes sense to fire this event when the file is not dirty and what the implications are. |
When saving a file that is not dirty, we run through a method I see not big reason why we could not add that one line into the touch method to have extensions be notified. The only gotcha is that previously every call to |
@bpasero does the |
@jrieken yeah it actually writes the contents to disk as they are to cause the OS to advance the |
Ok, that's changes things and we should fire the change event when stuff actually changes on disk. cc @DanTup how will like this new insights. |
Indeed! :) I actually noticed this the other day - I changed my things over to use watchers (not specifically to workaround this, but so that changing branch in git could be detected too) and noticed that hitting Ctrl+S in the file with no changes still triggered it. Even using the watcher it'll let me clean some things up, so this would be a nice change :-) (and if any handlers don't want to do work when the file wasn't actually changed, I presume they're able to check the isDirty flag themselves anyway). @jrieken thanks for the heads-up! :) |
via #73123 |
Update the minimum VS Code version to 1.35.0, in which the issue was fixed.
When saving a file that has no unsaved changes (i.e.
TextDocument.isDirty === false
), theworkspace.onWillSaveTextDocument
event fires, but theworkspace.onDidSaveTextDocument
event does not fire. However, the non-dirty file is still saved to the file system (its timestamp is updated).I'd like the state to be consistent between events firing and files being saved to the file system. So, either fire
onDidSaveTextDocument
, or do not save the file to the file system.The text was updated successfully, but these errors were encountered: