Skip to content
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

Tracking deleted files from a folder which is deleted #1317

Open
angelozerr opened this issue Sep 14, 2023 · 3 comments
Open

Tracking deleted files from a folder which is deleted #1317

angelozerr opened this issue Sep 14, 2023 · 3 comments
Labels
info-needed Issue requires more information from poster

Comments

@angelozerr
Copy link

We have a language server which need to track deleted files (//*.html files)
To do that we use workspace/didChangeWatchedFiles which is working great when user delete html files.

The problem comes from when a folder which contains html files are deleted.

  • on Windows OS with vscode, the language server receives the deleted folder only. In this case, how to retrieved the deleted files from the deleted folder?
  • on Mac OS with vscode, the language server receives the all deletedhtml files.

My first question is it an expected behavior (I mean a different behavior between 2 OS) ?

I discover the workspace/didDeleteFiles notification, what is the difference from the workspace/didChangeWatchedFiles

Many thanks for your clarification!

@rgrunber
Copy link

rgrunber commented Sep 15, 2023

According to #141 (comment) , the behaviour should be to only notify that the folder has been deleted in all cases. So this has regressed now it seems. The language client should try to protect against inconsistent behaviour across different platforms.

@dbaeumer
Copy link
Member

@bpasero I get these events 1:1 from VS Code. Is this expected?

@dbaeumer dbaeumer added the info-needed Issue requires more information from poster label Sep 18, 2023
@bpasero
Copy link
Member

bpasero commented Sep 18, 2023

Yes, it is expected that we do not send out delete events for each entry of a folder because listeners can easily figure out if a path is a child of said path and we can reduce the amount of events we have to send around:

https://github.com/microsoft/vscode/blob/d932af32771f4fcb8bef171f3114dfbd06ec5bed/src/vs/platform/files/common/watcher.ts#L377-L403

However, we rely on the operating system to give us the actual file events and our normalization of events works by accumulating events over some short period. If the OS gives us events slowly, above the threshold, we might start to send out individual deletes because we cannot find a common ancestor.

File events can be logged when you run code --verbose and look for [File Watcher (parcel)] entries in the developer tools console:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

4 participants