© 2024 borui. All rights reserved.
This content may be freely reproduced, displayed, modified, or distributed with proper attribution to borui and a link to the article:
borui(2024-03-12 22:05:26 +0000). vscode watcher out of file handle. https://borui/blog/2024-03-12-en-vscode-watcher-out-of-file-handle.
@misc{
borui2024,
author = {borui},
title = {vscode watcher out of file handle},
year = {2024},
publisher = {borui's blog},
journal = {borui's blog},
url={https://borui/blog/2024-03-12-en-vscode-watcher-out-of-file-handle}
}
summary
file watcher feature on vscode monitor changes in files and show git status of files on sidebar.
when it runs out of handle it won't be able to update the status and show correctly the status of whether the file is modified or not.
one simple suggestion needs no more settings is to collapse unused folders and close unused tabs, as I quote from below:
folder opened: folder is watched recursively for all changes via parcel, opened editors with files not within the folder are watched via node.js fs.watch
since according to this, collapsed folders won't be watched and closed tabs for files in collapesd folders won't be watched as well
original quote from vscode offcial repo on github
File Watcher Issues Ladislau Szomoru edited this page on Apr 11, 2022 · 2 revisions Some issues could originate from a problem with file watching. Let me explain how file watching works in VSCode first and then provide some details how to get more logging data from how file watching behaves in your case.
Synopsis VSCode has different strategies for file watching depending on your workspace and setup:
no folder opened: files in opened editors are watched via node.js fs.watch folder opened: folder is watched recursively for all changes via parcel, opened editors with files not within the folder are watched via node.js fs.watch If you are connected to a remote (SSH, WSL, Docker), the file watcher will run within the target file system. As such, even though you maybe on Windows where VSCode runs, if the remote is Linux, the file watcher will run in the Linux environment.
Platforms Depending on the platform you are on, file watching is differently implemented:
macOS: using fsevents services Windows: using ReadDirectoryChangesW method Linux: using inotify Specifically on Linux, watching a large folder recursively can result in VSCode consuming too many file handles. If that is the case, you will see a warning notification with instructions how to solve that.
Limitations File watching comes with a set of limitations:
symbolic links are not followed automatically but you can explicitly add symbolic links to be watched via the files.watcherInclude setting mapped network drives or third party file system drivers are not guaranteed to produce file events in general, the operating system may decide to drop file events at any time, there is no 100% guarantee Settings Please review your settings to see if maybe a folder is excluded by accident. Specifically, the files.watcherExclude setting is relevant.
- bpasero committed on Mar 4, 2022. Ladislau Szomoru edited on Apr 11, 2022 · 2 revisions. File Watcher Issues. Retrieved from https://github.com/microsoft/vscode/wiki/File-Watcher-Issues