【问题标题】:Visual Studio Code: make exception to files.exclude?Visual Studio Code:对 files.exclude 进行例外处理?
【发布时间】:2016-08-07 08:45:59
【问题描述】:

所以在 Visual Studio Code 中,我有一个 .vscode/settings.json,它定义了一些不显示的目录。

我有一些 node_modules 特定于我的项目并在我的仓库中维护。它们都以mycompany 开头。我想在 VSCode 中显示这些,而不是其他。

这是我目前在.vscode/settings.json 中的内容:

{
    // From http://stackoverflow.com/questions/33258543/how-can-i-exclude-a-directory-from-visual-studio-code-explore-tab
    "files.exclude": {
        "**/.git": true,        
        "**/.DS_Store": true,
        "**/.vscode": true,
        "**/.sass-cache": true,
        "node_modules/mycompany**": false, // Hoping this will override next line
        "node_modules/**": true
    }
}

我尝试交换最后两行的顺序,但这也不起作用。 如何忽略目录中的所有文件,除非它们以特定字符集开头?

【问题讨论】:

标签: visual-studio-code node-modules


【解决方案1】:

找到了一个解决方案,虽然不是很优雅)

{
    "files.exclude": {
        "**/node_modules/[^m]*": true,
        "**/node_modules/?[^y]*": true,
        "**/node_modules/??[^c]*": true,
        "**/node_modules/???[^o]*": true,
        "**/node_modules/????[^m]*": true,
        "**/node_modules/?????[^p]*": true,
        "**/node_modules/??????[^a]*": true,
        "**/node_modules/???????[^n]*": true,
        "**/node_modules/????????[^y]*": true
    }
}

【讨论】:

  • 这将忽略所有内容,除了 mycompany 开头 的内容。为了也排除例如mycompanyxyz,您必须添加"**/node_modules/mycompany?*": true
猜你喜欢
  • 1970-01-01
  • 2021-01-14
  • 2017-05-08
  • 1970-01-01
  • 2016-09-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-10-31
相关资源
最近更新 更多