How do I hide certain files from the sidebar in Visual Studio Code?

前端 未结 8 1158
终归单人心
终归单人心 2020-11-27 08:56

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<

相关标签:
8条回答
  • 2020-11-27 09:36

    For .meta files while using Unity3D, I found the best pattern for hiding is:

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

    This captures all folders and subfolders, and will pick up foo.cs.meta in addition to foo.meta

    0 讨论(0)
  • 2020-11-27 09:38

    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.

    0 讨论(0)
提交回复
热议问题