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

前端 未结 8 1160
终归单人心
终归单人心 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:15

    I would also like to recommend vscode extension Peep, which allows you to toggle hide on the excluded files in your projects settings.json.

    Hit F1 for vscode command line (command palette), then

    ext install [enter] peep [enter]
    

    You can bind "extension.peepToggle" to a key like Ctrl+Shift+P (same as F1 by default) for easy toggling. Hit Ctrl+K Ctrl+S for key bindings, enter peep, select Peep Toggle and add your binding.

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

    The "Make Hidden" extension works great!

    Make Hidden provides more control over your project's directory by enabling context menus that allow you to perform hide/show actions effortlessly, a view pane explorer to see hidden items and the ability to save workspaces to quickly toggle between bulk hidden items.

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

    If your working on a Angular 2+ application, and like me you like a clean working environment, follow @omt66 answer and paste the below in your settings.json file. I recommend you do this once all the initial setup has been completed.

    Note: This will actually hide the .vscode folder (with settings.json) in as well. (Open in your native file explorer / text editor if you need to make changes afterwards)

    https://pastebin.com/X2NL6Vxb

    {
        "files.exclude": {
            ".vscode":true,
            "node_modules/":true,
            "dist/":true,
            "e2e/":true,
            "*.json": true,
            "**/*.md": true,
            ".gitignore": true,
            "**/.gitkeep":true,
            ".editorconfig": true,
            "**/polyfills.ts": true,
            "**/main.ts": true,
            "**/tsconfig.app.json": true,
            "**/tsconfig.spec.json": true,
            "**/tslint.json": true,
            "**/karma.conf.js": true,
            "**/favicon.ico": true,
            "**/browserslist": true,
            "**/test.ts": true
        }
    }
    
    0 讨论(0)
  • 2020-11-27 09:20

    The __pycache__ folder and *.pyc files are totally unnecessary to the developer. To hide these files from the explorer view, we need to edit the settings.json for VSCode. Add the folder and the files as shown below:

    "files.exclude": {
      ...
      ...
      "**/*.pyc": {"when": "$(basename).py"}, 
      "**/__pycache__": true,
      ...
      ...
    }
    
    0 讨论(0)
  • 2020-11-27 09:24

    Sometimes you just want to hide certain file types for a specific project. In that case, you can create a folder in your project folder called .vscode and create the settings.json file in there, (i.e. .vscode/settings.json). All settings within that file will affect your current workspace only.

    For example, in a TypeScript project, this is what I have used:

    // Workspace settings
    {
        // The following will hide the js and map files in the editor
        "files.exclude": {
            "**/*.js": true,
            "**/*.map": true
        }
    }
    
    0 讨论(0)
  • 2020-11-27 09:33

    This may not me a so good of a answer but if you first select all the files you want to access by pressing on them in the side bar, so that they pop up on top of your screen for example: script.js, index.html, style.css. Close all the files you don't need at the top.

    When you're done with that you press Ctrl+B on windows and linux, i don't know what it is on mac.

    But there you have it. please send no hate

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