简体   繁体   中英

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

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

webstorm文件资源管理器

The files are not completely hidden.

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

  1. Select Project Files section of the side panel ( Project section does not offer the needed config menu)
  2. Click on the gear icon to configure 在此输入图像描述
  3. Select "Edit Scopes" from that menu
  4. Add a new Scope
  5. Set the Pattern to an appropriate filter to exclude the *.js and *.js.map files (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 Project or Project Files ) under the name you set the scope.
  • Enable Typescript Compiler (Generated files are hidden when compiler generates them)

在此输入图像描述

  • Change your view to Project as suggested by Cibes

在此输入图像描述

For me, using the Project panel, rather than the Project Files panel did the trick collapsing the *.js and .js.map files and hiding them beneath their corresponding *.ts file.

在此输入图像描述

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

WebStorm 2017.3.3

If you don't need run Enable Typescript Compiler .

You can do this

在此输入图像描述

Then

在此输入图像描述

After that, just select you filter

在此输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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