如何在 Visual Studio Code 的侧边栏中隐藏某些文件? [英] How do I hide certain files from the sidebar in Visual Studio Code?

查看:47
本文介绍了如何在 Visual Studio Code 的侧边栏中隐藏某些文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 Microsoft 的 Visual Studio Code,如何隐藏边栏中显示的某些文件和文件模式?

我想隐藏 .meta.git 样式文件

解决方案

您可以配置模式以在资源管理器和搜索中隐藏文件和文件夹.

  1. 打开 VS 用户设置(主菜单:File > Preferences > Settings).这将打开设置屏幕.
  2. 在顶部的搜索中搜索 files:exclude.
  3. 根据需要使用新的 glob 模式配置用户设置.在这种情况下,添加此模式 node_modules/ 然后单击 OK.模式语法很强大.您可以在

    如果要直接编辑设置文件:例如,在您的工作区中隐藏顶级 node_modules 文件夹:

    "files.exclude": {节点模块/":真}

    要隐藏在 OSX 上找到的所有以 ._ 开头的文件,例如 ._.DS_Store 文件:

    "files.exclude": {**/._*: 真的}

    您还可以更改工作区设置(主菜单:File > Preferences > Workspace Settings).工作区设置将在您当前的工作区中创建一个 .vscode/settings.json 文件,并且只会应用于该工作区.用户设置将全局应用于您打开的任何 VS Code 实例,但它们不会覆盖工作区设置(如果存在).阅读有关自定义用户和工作区设置的更多信息.

    Using Microsoft's Visual Studio Code, how do I hide certain files and file patterns from appearing in the sidebar?

    I want to hide .meta and .git style files

    解决方案

    You can configure patterns to hide files and folders from the explorer and searches.

    1. Open VS User Settings (Main menu: File > Preferences > Settings). This will open the setting screen.
    2. Search for files:exclude in the search at the top.
    3. Configure the User Setting with new glob patterns as needed. In this case add this pattern node_modules/ then click OK. The pattern syntax is powerful. You can find pattern matching details under the Search Across Files topic.

    When you are done it should look something like this:

    If you want to directly edit the settings file: For example to hide a top level node_modules folder in your workspace:

    "files.exclude": {
        "node_modules/": true
    }
    

    To hide all files that start with ._ such as ._.DS_Store files found on OSX:

    "files.exclude": {
        "**/._*": true
    }
    

    You also have the ability to change Workspace Settings (Main menu: File > Preferences > Workspace Settings). Workspace settings will create a .vscode/settings.json file in your current workspace and will only be applied to that workspace. User Settings will be applied globally to any instance of VS Code you open, but they won't override Workspace Settings if present. Read more on customizing User and Workspace Settings.

    这篇关于如何在 Visual Studio Code 的侧边栏中隐藏某些文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆