【问题标题】:Why is Find in Files in Visual Studio Code OSX ignoring my search.excludeFolders setting?为什么在 Visual Studio Code OSX 中的文件中查找忽略了我的 search.excludeFolders 设置?
【发布时间】:2015-07-10 12:32:12
【问题描述】:

即使使用默认配置,在进行工作区搜索时,我仍然会在各种 node_modules 文件夹中获得大量结果。

默认设置:

"search.excludeFolders": [
        ".git",
        "node_modules",
        "bower_components"
    ],

我什至尝试复制到我的用户设置并更改为多个变体,例如“/node_modules”、“/node_modules/”等。

我已经在 vscode 中看到了关于这个问题的另一篇文章:How can I choose folders to be ignored during search?。这个答案没有解决我的问题。

我在 OS X 上使用 0.1.0 版(提交 d13afe1)。排除文件夹是否有错误?

【问题讨论】:

  • 我也在 OSX 上使用 0.1.0。我无法复制您遇到的问题。例如,我有一个“public”文件夹,当我将“public”添加到 excludeFolders 数组时,对于任何存在于 public 的文件,全文搜索结果和 CMD+E(转到文件)结果都将被省略。

标签: search visual-studio-code


【解决方案1】:

在再次阅读您的问题并尝试之后,我才注意到search.excludeFolders 值仅适用于工作区根目录。因此,对于层次结构中的 node_modules 文件夹,您需要使用:

{
    "search.excludeFolders": [
        ".git",
        "node_modules",
        "bower_components",
        "path/to/node_modules"
    ]
}

【讨论】:

    【解决方案2】:

    自@alex-dima 的回答以来,这些偏好似乎已经改变。

    App -> Preferences -> User/Workspace Settings
    

    您可以选择将应用于搜索的自定义设置。例如,我正在开发一个 EmberJS 应用程序,它在 tmp 目录下保存了数千个文件。

    更新设置前的搜索图片。

    更新 Visual Studio 设置后。

    {
        "search.exclude": {
            "**/.git": true,
            "**/node_modules": true,
            "**/bower_components": true,
            "**/tmp": true
        }
    }
    

    注意:在任何搜索排除的开头包含一个 ** 以涵盖所有文件夹和子文件夹中的搜索词。

    搜索结果正是我想要的。

    更新设置后的搜索图片。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-02-16
      • 2015-09-17
      • 1970-01-01
      • 1970-01-01
      • 2021-12-20
      • 2017-05-21
      • 1970-01-01
      • 2020-02-12
      相关资源
      最近更新 更多