-
Notifications
You must be signed in to change notification settings - Fork 29.4k
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
onDidDeleteFiles misfires when file is already deleted from a different app #86217
Comments
This sentence reads weird to me, can you clarify exactly what you expect? Do you mean the event should fire even if the file does not exist? |
Ah sorry, I was describing what is happening at the moment. When events are delayed in the I am expecting the event to not fire when the file is already deleted and also it should not trigger a dialog asking to delete something thats already deleted. |
Is this just a test case issue or a real world scenario we want to support eventually? To summarise:
I am not even sure how to solve this issue properly because the state of the file system when the operation started might not be the same anymore after the event has fired. The same applies for create and move. Open for suggestions. |
For the delete method at least we could send the event and afterwards do an additional check if the file exists assuming that someone might have deleted it already. |
Didn't think about a real world scenario for this, aim here was to demonstrate an evil scenario. The current api design seems too easy to make evil extensions that will just mess UI with the file operations in the explorer because of the Avoiding |
Because they often need to do some async computation before knowing if this event requires followup work. E.g. before renaming a file a language service computes further edits and that's usually async. I don't think much is wrong here and disagree that this is a sharp knife for evil extensions. Tho, I think is fishy is this
When deleting fails it should not continue. @bpasero is it that the underlying file service handles the error already and that this never throws? |
@jrieken yes, |
Yeah, that's what I am suggesting. Otherwise I don't know how to prevent the firing of a did-delete-event in the case of failure. Generally, file operations like delete are prone for failure and IMO the caller of such methods should handle those failure (and they are likely the best suited for doing so) |
Well the alternative solution would be what I suggested earlier: the text file service needs to validate the state of files after the various potentially long running events have been fired. E.g.:
|
|
Maybe I need more repro steps, but still see what I think Deepack is reporting in the initial issue
Please let me if there's a different verification I should try running. |
@connor4312 after proceeding to |
Ah, okay. Yes I can verify that after hitting "Delete Permanently" we no longer get an error popup |
When testing #85929
Steps to reproduce:
use the code example from Deleting multiple files through explorer invokes the event listeners per file #86210 that purposely delays the response from
willDeleteFiles
handler.Delete a file in the explorer, while the delay from the above handler happens
Delete the file from terminal
After the
willDeleteFiles
resolves, it will trigger popup with delete operation failed and should permanently delete the file, and also trigger theonDidDeleteFiles
eventWhen similar thing is performed with the rename handlers, while you try to rename through explorer and delete the file from terminal, the
onDidRenameFiles
will not resolve, which seems like the behavior that should be followed here as well ?The text was updated successfully, but these errors were encountered: