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 · 5 comments
Open

Tracking deleted files from a folder which is deleted #1317

angelozerr opened this issue Sep 14, 2023 · 5 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

@michprev
Copy link

I am receiving no event(s) at all after deleting a directory containing *.sol file(s) with the watchdog configured as:

FileSystemWatcher(
    glob_pattern="**/*.sol",
    kind=None,
),

Is this an expected behavior?

My VS Code setup:

Version: 1.90.2
Commit: 5437499feb04f7a586f677b155b039bc2b3669eb
Date: 2024-06-18T22:54:35.075Z
Electron: 29.4.0
ElectronBuildId: 9728852
Chromium: 122.0.6261.156
Node.js: 20.9.0
V8: 12.2.281.27-electron.0
OS: Darwin arm64 23.5.0

@dbaeumer
Copy link
Member

dbaeumer commented Jul 1, 2024

As @bpasero pointed out we only send out events for the folder when a folder gets deleted. So you need to register for folder deletions as well.

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

5 participants