Choose folders to be ignored during search in VS Code

前端 未结 16 948
既然无缘
既然无缘 2020-11-28 18:10

Right now when I use +O to search for files, the fuzzy matching appears to operate over all files in the current project. Unfortunately, this includes

相关标签:
16条回答
  • 2020-11-28 18:22

    Update April 2018

    You can do this in the search section of vscode by pre-fixing an exclamation mark to each folder or file you want to exclude.

    0 讨论(0)
  • 2020-11-28 18:26

    After you setup the search.exclude and file.exclude mentioned on the previous answers, run the command "Clear Editor History" (Use the Command Palette to do that - CTRL + SHIFT + P).

    Only after that the excluded files will not appear on your quick open menu.

    Update: You can run the command "Clear Command History" too. I forgot about that.

    0 讨论(0)
  • 2020-11-28 18:27

    Make sure the 'Use Exclude Settings and Ignore Files' cog is selected

    0 讨论(0)
  • 2020-11-28 18:27

    If I understand correctly you want to exclude files from the vscode fuzzy finder. If that is the case, I am guessing the above answers are for older versions of vscode. What worked for me is adding:

    "files.exclude": {
        "**/directory-you-want-to-exclude": true,
        "**/.git": true,
        "**/.svn": true,
        "**/.hg": true,
        "**/CVS": true,
        "**/.DS_Store": true
    }
    

    to my settings.json. This file can be opened through File>Preferences>Settings

    0 讨论(0)
  • 2020-11-28 18:29

    This answer is outdated

    If these are folders you want to ignore in a certain workspace, you can go to:

    AppMenu > Preferences > Workspace Settings

    Otherwise, if you want these folders to be ignored in all your workspaces, go to:

    AppMenu > Preferences > User Settings

    and add the following to your configuration:

    //-------- Search configuration --------
    
    // The folders to exclude when doing a full text search in the workspace.
    "search.excludeFolders": [
        ".git",
        "node_modules",
        "bower_components",
        "path/to/other/folder/to/exclude"
    ],
    

    The difference between workspace and user settings is explained in the customization docs

    0 讨论(0)
  • 2020-11-28 18:33

    Extending the most voted answer, now there is an extension to achieve what is described there to toggle quickly in a GUI way. It's called Explorer Exclude. You can install this with this command:

    ext install RedVanWorkshop.explorer-exclude-vscode-extension
    

    Demo:

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