gpt4 book ai didi

visual-studio-code - 如何从 "Explore"选项卡中排除文件夹?

转载 作者:行者123 更新时间:2023-12-03 04:07:06 25 4
gpt4 key购买 nike

我正在尝试排除 Visual Studio Code 中探索选项卡上的多个文件夹。为此,我将以下 jsconfig.json 添加到项目的根目录:

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

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

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

最佳答案

使用files.exclude :

  • 转至文件 -> 首选项 -> 设置(或在 Mac 上代码 -> 首选项 -> 设置)
  • 选择工作区设置选项卡
  • 将此代码添加到右侧显示的 settings.json 文件中:
    // 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
}
}
}

如果您选择文件 -> 首选项 -> 用户设置,则您可以为当前用户全局配置排除文件夹。

关于visual-studio-code - 如何从 "Explore"选项卡中排除文件夹?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33258543/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com