Filter file types in project

How can I hide .js and .js.map files from the project window in a Typescript based Angular2 project?

5 comments
Comment actions Permalink

the only way to completely hide certain files is ignoring them - this can be done by adding corresponding file patterns to 'Ignore files and folders' in Settings | Editor | File types. These files will be excluded from project and indexing and hidden in the Project tool window.

But note that when .ts files are compiled using built-in Typescript compiler service or file watchers, the generated .js and .js/map files are visually nested inside original .ts files and thus are hidden unless the .ts node is expanded:

1
Comment actions Permalink

This works, but this setting effects all projects which is not preferred. Is it possible to do this setting for a particular project only?

0
Comment actions Permalink

No, this option is IDE-wide.

On a project level, you can only exclude certain folders, but not individual files. You can set up the compiler to save .js and .map files to a separate folder, and then exclude this folder from project using Mark directory as/Excluded

1
Comment actions Permalink

@Elena That sound perfect. Where can I set up the compiler to save .js and .map files to a separate folder?

0
Comment actions Permalink

When using the built-in TypeScript compiler, you can specify the output directory in your tsconfig.json:

"outDir": "dist"

if you are not using tsconfig, you can pass the --outDir option to compiler (https://www.typescriptlang.org/docs/handbook/compiler-options.html)

0

Please sign in to leave a comment.