编辑 .vscode/settings.json
添加:(注意是 settings.json 不是 setting.json)
例如
{"files.watcherExclude": {"**/.git/objects/**": true,"**/.git/subtree-cache/**": true,"**/node_modules/**": true,"**/bower_components/**": true,"**/dist/**": true,"**/build/**": true,"**/.next/**": true,"**/.nuxt/**": true,"**/.cache/**": true,"**/.tmp/**": true,"**/.vscode-test/**": true,"**/vendor/**": true},"python.analysis.exclude": ["**/__pycache__/**","**/.git/**","**/.svn/**","**/.hg/**","**/CVS/**","**/.DS_Store/**","**/node_modules/**","**/bower_components/**","**/dist/**","**/build/**","**/.next/**","**/.nuxt/**","**/.cache/**","**/.tmp/**","**/.vscode-test/**","**/vendor/**","**/venv/**","**/env/**","**/env_*/**"]
}
files.watcherExclude 设置用于指定哪些文件或文件夹应该被文件监视器(file watcher)忽略。文件监视器用于检测文件的变化,以便在文件被修改时触发相应的操作,例如重新加载文件或更新编辑器中的内容。
python.analysis.exclude 设置用于指定哪些文件或文件夹应该被 Python 语言服务器(如 Pylance 或 Microsoft Python Language Server)忽略。这些语言服务器用于提供代码补全、类型检查、重构等功能。