设置VsCode搜索时排除文件,文件列表中隐藏文件

按照《VsCode + gdb + gdbserver远程调试C++程序》中介绍的方法,配置好VsCode后,打开一个C/C++工程,发现左侧的面板会显示编译时生成的中间文件(比如.d和.o文件)。我们可以通过设置隐藏掉一些我们不需要打开的文件以简洁面板:

编辑.vscode子目录下的settings.json中的search.exclude配置可以实现搜索时排除文件,编辑files.exclude配置可以实现文件列表中隐藏文件。以下面的settings.json为例,下面设置表示隐藏和搜索时排除后缀名为.0,.d,.a,.pc,.so的文件:

bash 复制代码
{
    "files.associations": {
        "random": "c",
        "ratio": "c",
        "sstream": "c"
    }
    "search.exclude": {
        "**/*.o"           :true,
        "**/*.d"         :true,
        "**/*.a"           :true,
        "**/*.pc"           :true,
        "**/*.so"         :true
    }
    "files.exclude": {
        "**/*.o"           :true,
        "**/*.d"         :true,
        "**/*.a"           :true,
        "**/*.pc"           :true,
        "**/*.so"         :true
    }
}

修改完settings.json后,重新打开VsCode,会发现设置已生效。

相关推荐
Zhang~Ling3 小时前
Vim 多模式详解:命令、插入、底行与插件配置
linux·编辑器·vim
love530love5 小时前
用自然语言让 AI Agent 卸载软件 —— 以卸载 Visual Studio 2026 为例
ide·人工智能·windows·agent·visual studio·ai agent·marvis
落寞的电源10 小时前
使用Visual Studio SDK制作GLSL词法着色插件
ide·visual studio
fenghx25813 小时前
仅用于个人记录:火狐有网,Vscode的codex连不上
vscode·编辑器
LL34363813 小时前
2026最新5款AI编程工具平替实测|终端与IDE vibe coding迭代优缺点深度对比
ide·ai编程
HhzZzzzz_13 小时前
萨科微slkor2026年7月6日“每日芯闻”。国际芯闻:
人工智能·智能手机·编辑器
00后程序员张13 小时前
iOS 打包方式汇总 从 Xcode Archive 到轻量级工具链的 IPA 构建
ide·vscode·ios·objective-c·个人开发·swift·敏捷流程
Balabala噗14 小时前
VScode接入MiniMax流程
ide·vscode·编辑器
诚信定制8391 天前
Typora:一款优雅的跨平台 Markdown 编辑器
编辑器
渣渣盟2 天前
Linux软件管理与编辑器命令速查手册
linux·运维·编辑器