即使使用默认配置,在进行工作区搜索时,我仍然会在各种node_modules文件夹中获得大量结果。
默认设置:
"search.excludeFolders": [
".git",
"node_modules",
"bower_components"
],
我什至尝试复制到我的用户设置并更改为多个变体,例如“/node_modules”、“/node_modules/”等。
我已经在vscode中看到了关于这个问题的另一篇文章:我如何在搜索过程中选择要忽略的文件夹。这个答案不能解决我的问题。
我在OS X上用的是0.1.0版本(提交d13afe1)。排除文件夹会不会有问题?
再次阅读您的问题并尝试后,直到现在我才注意到 search.excludeFolder
值仅适用于工作区根目录。因此,对于层次结构中的node_modules
文件夹,需要使用:
{
"search.excludeFolders": [
".git",
"node_modules",
"bower_components",
"path/to/node_modules"
]
}
自从@亚历克斯-马頔的回答后,这些偏好似乎发生了变化。
App -> Preferences -> User/Workspace Settings
您可以选择将应用于搜索的自定义设置。例如,我正在开发一个EmberJS应用程序,它在tmp目录下保存了数千个文件。
更新Visual Studio设置后。
{
"search.exclude": {
"**/.git": true,
"**/node_modules": true,
"**/bower_components": true,
"**/tmp": true
}
}
注意:在任何搜索排除的开头包含一个**,以覆盖任何文件夹和子文件夹上的搜索词。
搜索结果正是我想要的。