本文翻译自:How do I hide certain files from the sidebar in Visual Studio Code?

Using Microsoft's Visual Studio Code, how do I hide certain files and file patterns from appearing in the sidebar? 使用Microsoft的Visual Studio代码,如何隐藏侧边栏中显示的某些文件和文件模式?

I want to hide .meta and .git style files 我想隐藏.meta.git样式文件


#1楼

参考:https://stackoom.com/question/22Soq/如何在Visual-Studio代码中隐藏侧栏中的某些文件


#2楼

You can configure patterns to hide files and folders from the explorer and searches. 您可以配置模式以从资源管理器和搜索中隐藏文件和文件夹。

  1. Open VS User Settings (Main menu: File > Preferences > Settings). 打开VS用户设置(主菜单:文件>首选项>设置)。 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. 根据需要使用新的glob模式配置用户设置。 In this case add this pattern node_modules/ then click OK. 在这种情况下,添加此模式node_modules/然后单击“确定”。 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: 如果要直接编辑设置文件:例如,要隐藏工作区中的顶级node_modules文件夹:

"files.exclude": {"node_modules/": true
}

To hide all files that start with ._ such as ._.DS_Store files found on OSX: 要隐藏所有以._开头的文件,例如在OSX上找到的._。DS_Store文件:

"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. 工作区设置将在当前工作空间中创建.vscode/settings.json文件,并且仅应用于该工作空间。 User Settings will be applied globally to any instance of VS Code you open, but they won't override Workspace Settings if present. 用户设置将全局应用于您打开的任何VS代码实例,但如果存在,它们将不会覆盖工作区设置。 Read more on customizing User and Workspace Settings . 阅读有关自定义用户和工作区设置的更多信息 。


#3楼

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, (ie .vscode/settings.json ). 在这种情况下,您可以在项目文件夹中创建一个名为.vscode的文件夹,并在其中创建settings.json文件(即.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: 例如,在TypeScript项目中,这是我使用的:

// Workspace settings
{// The following will hide the js and map files in the editor"files.exclude": {"**/*.js": true,"**/*.map": true}
}

#4楼

I would also like to recommend vscode extension Peep , which allows you to toggle hide on the excluded files in your projects settings.json. 我还想推荐使用vscode扩展Peep ,它允许您在项目settings.json中的被排除文件上切换隐藏。

Hit F1 for vscode command line (command palette), then 然后按F1键查看vscode命令行(命令调色板)

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. 您可以将“extension.peepToggle”绑定到一个键,如Ctrl + Shift + P(默认情况下与F1相同),以便轻松切换。 Hit Ctrl+K Ctrl+S for key bindings, enter peep , select Peep Toggle and add your binding. 按Ctrl + K Ctrl + S进行键绑定,输入peep ,选择Peep Toggle并添加绑定。


#5楼

For .meta files while using Unity3D, I found the best pattern for hiding is: 对于使用Unity3D时的.meta文件,我发现隐藏的最佳模式是:

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

This captures all folders and subfolders, and will pick up foo.cs.meta in addition to foo.meta 这捕获所有文件夹和子文件夹,并会拿起foo.cs.meta除了foo.meta


#6楼

The " Make Hidden " extension works great! “ Make Hidden ”扩展功能非常棒!

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. 通过启用允许您轻松执行隐藏/显示操作的上下文菜单,使用视图窗格浏览器查看隐藏项目以及保存工作区以在批量隐藏项目之间快速切换的功能,“隐藏”可以更好地控制项目目录。

如何在Visual Studio代码中隐藏侧栏中的某些文件?相关推荐

  1. vscode中怎样格式化js代码_如何在Visual Studio代码(VSCode)中格式化代码

    回答(30) 2 years ago 对于那些想要自定义要格式化的JavaScript文件的人,可以使用 JSfiles 属性上的任何扩展名同样适用于HTML . { "beautify.o ...

  2. 如何在Visual Studio Code中编译C ++代码

    PS: This was published on my Blog here. PS:这已发布在我的Blog 此处 . C++ is a statically-typed, free-form, (u ...

  3. java代码如何与界面联系在一起_如何在Visual Studio Code 中编写Java代码

    本文将展示如何在Visual Studio Code中用Java编写和运行一个简单的Hello World程序. 首先您必须在本地开发环境中安装Java SE开发工具包(JDK) Visual Stu ...

  4. vscode 注释多行代码_如何在Visual Studio Code中注释多行?

    我找不到在Visual Studio Code中注释和取消注释多行代码的方法. 是否可以使用某些快捷方式在Visual Studio Code中注释和取消注释多行? 如果是,该怎么办? 当其中一行已被 ...

  5. 直接在Visual Studio代码编辑器中加密字符串文件

    String encryption is used everywhere in desktop & mobile software. You might not even know about ...

  6. 如何在Visual Studio中“添加现有项”整个目录结构?

    我有一个独立于任何C#项目的独立文件集,它们位于复杂的嵌套目录结构中. 我想以这种格式将它们添加到我正在处理的ASP.NET Web应用程序中的不同目录中; 同时保留相同的结构. 所以,我将文件夹复制 ...

  7. 如何在Visual Studio 2010中使用CppUTest建立TDD的Code Kata的环境

    CppUTest 是一个功能全面的测试框架,是为了支持在多种操作系统上开发嵌入式软件而特别设计的.CppUTest的宏被设计成不需要了解C++也可以写测试用例.这使得C程序员更容易用这个测试框架. 那 ...

  8. 在Visual Studio代码中显示空白字符

    本文翻译自:Show whitespace characters in Visual Studio Code Is it possible to show whitespace characters, ...

  9. [译]如何在visual studio中调试Javascript

    本文翻译youtube上的up主kudvenkat的javascript tutorial播放单 源地址在此: https://www.youtube.com/watch?v=PMsVM7rjupU& ...

最新文章

  1. java为啥要捕捉异常_java – 为什么在捕获时使用IOexception而不是Exception?
  2. 《Linux菜鸟入门》认识linux系统
  3. 【Linux 内核】实时调度类 ② ( 实时调度实体 sched_rt_entity 源码分析 | run_list、timeout、watchdog_stamp、time_slice 字段 )
  4. C++程序的内存布局
  5. 发现你的身形——OpenCV图像轮廓
  6. 24行代码AC_蓝桥杯2019省赛 试题 D: 数的分解
  7. 【OpenCV 例程200篇】90. 频率域陷波滤波器
  8. python-发邮件脚本
  9. windows上怎么用libnfc的库函数编程
  10. java list 超出范围_java.sql.SQLException参数索引超出范围(1参数个数,即0)
  11. JavaScript 开发者的 5 款必备工具
  12. Centos7+搜狗拼音输入法 安装不踩雷
  13. BZOJ 4816(莫比乌斯反演
  14. 基因组测序分析linux,基因组数据的重测序分析
  15. HTML基础-DAY1
  16. pytorch基础(九)- 自定义数据集训练模型 和 迁移学习
  17. Software Architecture Pattern(Mark Richards)笔记
  18. 组装台式机后进入PE,检测不到硬盘的解决方法
  19. 木偶然-2010.7.17
  20. 虚拟机安装 windows xp sp3 原版镜像

热门文章

  1. H5跳转App、跳转小程序
  2. 机器人大爷 感
  3. Vue项目中将时间格式成xxxx-xx-xx
  4. 读书有益——》《让我留在你身边》
  5. 工控机在全自动洗车系统中的应用
  6. 程序yuan开发-windows小工具:gif截图-LICEcap、文件查找-Everything、远程软件-TeamView、视频播放-PotPlayer、markdown编辑-Typora、
  7. 商务网站建设与维护【1】
  8. 英特尔发布第11代核心Tiger Lake笔记本电脑处理器
  9. 谷歌三大论文中文版之一:Bigtable:一个分布式的结构化数据存储系统
  10. html实现ppt的效果,js、css实现ppt的出现效果