You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

VS Code工作区如何隐藏并禁止加载指定扩展名的文件

VS Code 文件排除规则不生效解决方案
  • 优先排查配置规则覆盖范围问题:你当前写的*.log这类规则仅能匹配工作区根目录下的对应后缀文件,无法匹配嵌套子目录内的同后缀文件,需要改为带递归通配符的规则**/*.log,**代表匹配所有层级的子目录。
  • 确认当前打开的是对应.code-workspace后缀的工作区文件,而非直接打开单个文件夹,否则工作区配置不会生效。
  • 若需要同时降低索引、搜索、文件监听带来的性能损耗,可额外添加search.exclude、files.watcherExclude配置,三类规则叠加即可实现完全隐藏+禁止加载对应文件的需求。

修改后的完整配置示例:

"folders": [
    {
        "path": "directory1"
    }
],
"settings": {
    "files.exclude": {
        "**/*.log": true,
        "**/*.lib": true,
        "**/*.sbr": true,
        "**/*.bak": true,
        "**/*.error": true
    },
    "search.exclude": {
        "**/*.log": true,
        "**/*.lib": true,
        "**/*.sbr": true,
        "**/*.bak": true,
        "**/*.error": true
    },
    "files.watcherExclude": {
        "**/*.log": true,
        "**/*.lib": true,
        "**/*.sbr": true,
        "**/*.bak": true,
        "**/*.error": true
    },
    "files.associations": {
        "*.tsl": "C++"
    }
}

配置修改完成后按Ctrl+Shift+P(Windows)/Cmd+Shift+P(Mac)呼出命令面板,执行Reload Window重载窗口即可生效。

内容的提问来源于stack exchange,提问作者Directx995

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.28 05:15:02