如何从“浏览"中排除文件夹标签? [英] How to exclude folder from "Explore" tab?

查看:37
本文介绍了如何从“浏览"中排除文件夹标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在 Visual Studio Code 的 Explore 选项卡上排除几个文件夹.为此,我在项目的根目录中添加了以下 jsconfig.json:

I'm trying to exclude several folders on the Explore tab in Visual Studio Code. To do that, I have added a following jsconfig.json to the root of my project:

{
    "compilerOptions": {
        "target": "ES6"
    },
    "exclude": [
        "node_modules"
    ]
}

但是 node_modules 文件夹在目录树中仍然可见.

But the node_modules folder is still visible in the directory tree.

我做错了什么?还有其他选择吗?

What am I doing wrong? Are there any other options?

推荐答案

使用 files.exclude:

  • 转到文件 ->首选项 ->设置(或在 Mac 上代码 -> 首选项 -> 设置)
  • 选择工作区设置标签
  • 将此代码添加到右侧显示的settings.json文件中:
  • Go to File -> Preferences -> Settings (or on Mac Code -> Preferences -> Settings)
  • Pick the workspace settings tab
  • Add this code to the settings.json file displayed on the right side:
    // Place your settings in this file to overwrite default and user settings.

    {
        "settings": {
            "files.exclude": {
                "**/.git": true,         // this is a default value
                "**/.DS_Store": true,    // this is a default value
    
                "**/node_modules": true, // this excludes all folders 
                                        // named "node_modules" from 
                                        // the explore tree
    
                // alternative version
                "node_modules": true    // this excludes the folder 
                                        // only from the root of
                                        // your workspace 
            }
        }
    }

如果您选择了文件 ->首选项 ->用户设置,然后为当前用户全局配置排除文件夹.

If you chose File -> Preferences -> User Settings then you configure the exclude folders globally for your current user.

这篇关于如何从“浏览"中排除文件夹标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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