在处理 Angular2-typescript 项目时如何在 WebStorm 中隐藏 .js 和 .map 文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/36183470/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 03:22:14  来源:igfitidea点击:

How to hide .js and .map files in WebStorm while working on Angular2-typescript project

typescriptangularwebstorm

提问by runtimeZero

I tried adding the extensions to .gitignorebut the result is as below:

我尝试添加扩展名,.gitignore但结果如下:

webstorm file explorer

网络风暴文件浏览器

The files are not completely hidden.

文件并未完全隐藏。

回答by sleidig

When using WebStorm without the built-in TypeScript Compiler (e.g. because you are running an Angular2 project with their npm startscript which does the compiling already) and the other method doesn't work, you can configure your own filtered "Project" panel for WebStorm:

当在没有内置 TypeScript 编译器的情况下使用 WebStorm 时(例如,因为您正在运行一个 Angular2 项目,其npm start脚本已经进行了编译)并且其他方法不起作用,您可以为 WebStorm 配置您自己的过滤“项目”面板:

  1. Select Project Filessection of the side panel (Projectsection does not offer the needed config menu)
  2. Click on the gear icon to configure enter image description here
  3. Select "Edit Scopes" from that menu
  4. Add a new Scope
  5. Set the Pattern to an appropriate filter to exclude the *.jsand *.js.mapfiles (I am using !file[my-root-folder]:app//*.js&&!file[my-root-folder]:app//*.js.map)
  6. You can select this scope as a section of the side panel (instead of Projector Project Files) under the name you set the scope.
  1. Project Files侧面板的选择部分(该Project部分不提供所需的配置菜单)
  2. 单击齿轮图标进行配置 enter image description here
  3. 从该菜单中选择“编辑范围”
  4. 添加新范围
  5. 将模式设置为适当的过滤器以排除*.js*.js.map文件(我正在使用!file[my-root-folder]:app//*.js&&!file[my-root-folder]:app//*.js.map
  6. 您可以选择此范围作为您设置范围名称下的侧面板的一部分(而不是ProjectProject Files)。

回答by Ankit Singh

  • Enable Typescript Compiler(Generated files are hidden when compiler generates them)
  • 启用 Typescript 编译器(生成的文件在编译器生成时被隐藏)

enter image description here

enter image description here

  • Change your view to Projectas suggested by Cibes
  • Project按照Cibes 的建议将您的视图更改

enter image description here

enter image description here

回答by sleidig

For me, using the Projectpanel, rather than the Project Filespanel did the trick collapsing the *.jsand .js.mapfiles and hiding them beneath their corresponding *.tsfile.

对我来说,使用Project面板而不是Project Files面板来完成折叠*.js.js.map文件并将它们隐藏在相应*.ts文件下的技巧。

enter image description here

enter image description here

Note: This is only working when WebStorm's TypeScript Compiler is enabled. (see A_Singh's answer)

注意:这仅在启用 WebStorm 的 TypeScript 编译器时有效。(见 A_Singh 的回答

回答by Andrey Patseiko

WebStorm 2017.3.3

网络风暴 2017.3.3

If you don't need run Enable Typescript Compiler.

如果您不需要运行Enable Typescript Compiler

You can do this

你可以这样做

enter image description here

enter image description here

Then

然后

enter image description here

enter image description here

After that, just select you filter

之后,只需选择您的过滤器

enter image description here

enter image description here