「VSCode」 – 常见错汇总

  CREATED BY JENKINSBOT

Unable to watch for file changes in this large workspace folder

Visual Studio Code User and Workspace Settings
Running Visual Studio Code on Linux

问题描述

Unable to watch for file changes in this large workspace folder. Please follow the instructions link to resolve this issue.

原因分析

工作目录的文件过多,导致 VS Code File Watcher 的句柄用完了,而无法检测全部文件的变更。

解决方案

忽略不必要的文件:

# .vscode/settings.json
{
    "files.watcherExclude": {
        "**/.git/objects/**": true,
        "**/.git/subtree-cache/**": true,
        "**/node_modules/*/**": true,
        "**": false
    }
}

增加文件句柄数:

# /etc/sysctl.conf
fs.inotify.max_user_watches=524288