简体   繁体   English

如何从我的 phpstorm 项目中隐藏一些文件

[英]How can I hide a few files from my phpstorm project

In my PhpStorm project, I have a few files that sit in the root folder and are not modified often.在我的 PhpStorm 项目中,我有一些文件位于根文件夹中并且不经常修改。在此处输入图像描述

For example here I rarely touch files like favicon, gruntfile, humans, package, robots, gitignore .例如,在这里我很少接触favicon, gruntfile, humans, package, robots, gitignore So out of all 9 files I only need 3. I can not remove them (they still needed for the project) and they distract my attention.因此,在所有 9 个文件中,我只需要 3 个。我无法删除它们(项目仍然需要它们),它们会分散我的注意力。

So I am looking for a way to hide/exclude them.所以我正在寻找一种隐藏/排除它们的方法。 I was able to find similar approach with folders , but it works only with folders.我能够找到与 folders 类似的方法,但它仅适用于文件夹。 On official phpstorm page there is a page which sounds similar but does something completely different (files still stay in the few, you just can not autocomplete anything from them).在官方的 phpstorm 页面上,有一个页面听起来很相似,但做的事情完全不同(文件仍然很少,你只是无法从中自动完成任何内容)。 Also this answer from SO is also dealing with code inspection, not hiding files.此外,来自 SO 的这个答案也在处理代码检查,而不是隐藏文件。

  1. Settings | Scopes

  2. Create new scope that would include only files/folders you want (or opposite: exclude all unwanted files/folders) 创建仅包含所需文件/文件夹的新范围(或相反:排除所有不需要的文件/文件夹)

  3. Use that scope in Project View panel instead of default "Project" 在“项目视图”面板中使用该范围而不是默认的“项目”

甚至更简单:单击项目窗格中的齿轮图标并取消选中“显示排除的文件”。

For later versions of PhpStorm (I'm using PhpStorm 2022.1):对于更高版本的 PhpStorm(我使用的是 PhpStorm 2022.1):

  1. Exclude unwanted files or folders排除不需要的文件或文件夹
  2. Open preferences打开首选项
  3. Search for show excluded搜索show excluded
  4. Under the Keymap menu, define a shortcut for toggling Show Excluded Files and press OK在 Keymap 菜单下,定义用于切换Show Excluded Files的快捷方式,然后按OK
  5. Use the shortcut in the IDE to show/hide excluded files使用 IDE 中的快捷方式显示/隐藏排除的文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM