How can hide autogenerated files by TypeScript in NerdTree?
Asked Answered
C

3

6

I want to hide the auto generated files (.js .js.map) by Typescript transpiler in NERDTree.

Cannady answered 27/3, 2016 at 13:16 Comment(0)
C
5

Thanks to Hussein Nazzal, I've managed to solve it this way (because I'm using Angular2 there are a couple of steps to be aware):

  • Add an outDir property to tsconfig.json this way:

    {
      "compilerOptions": {
        "target": "es5",
        "module": "system",
        "moduleResolution": "node",
        "sourceMap": true,
        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
        "removeComments": false,
        "noImplicitAny": false, 
        "outDir": "buildjs/"
      },
      "exclude": [
        "node_modules",
        "typings/main",
        "typings/main.d.ts"
      ]
    }
    
  • Then in .vimrc file add the following:

    let NERDTreeIgnore=['buildjs$']
    
  • Don't forget to modify index.html and add the following line near System.import('buildjs/main'),

    System.import('app/main')`
    
  • add to System.config

    map: {
      app: 'buildjs'
    }
    
Cannady answered 27/3, 2016 at 15:39 Comment(3)
This is the best answer. I used 'dist' instead of 'buildjs', but this worked great. Thanks!Malinowski
Great. I tried fiddling with System.config in index.html - don't do that :) Change the mapping in systems.config.js instead.Pilgarlic
Not a huge fan of this method, you're not hiding autogenerated files, you're simply generating them in a different directory.Sharpsighted
I
2

to hide files use the NERDTreeIgnore

let NERDTreeIgnore = ['\.js$' , '\.js.map$']

the following line should be used in your vimrcfile

Initiative answered 27/3, 2016 at 13:41 Comment(5)
the problem is, I don't want to hide javascript files, only the auto generated by typescript.Cannady
this will depend on the method used for transpiling files ... do you use ` --outFile` if you do then you could specify out file to be somefile.generated.ts and add '\.generated.ts$' to the ignore list. if you are using gulp you could do similar thing as well .. but there is no other ways to know if the file is a generated file or other wise.but if you output your files in a dist directory you might as well hide the dirInitiative
I'm using angular2 configuration, I guess there's have to be a way to configure it using the tsconfig.json file.Cannady
then just specify "outDir" and hide the folder ... or concatenate your files using "outFile" here is a list of ts config options json.schemastore.org/tsconfigInitiative
I think what @WernerEchezuria wants is to hide .js files if a .ts file by the same name (minus the extension) exists in the same directory. At least that's what I would like to figure out how to do.Akihito
D
1

If you type I (uppercase i) in NERDTree you can toggle the visibility of hidden files.

To hide the files by default put this line in your vimrc:

let NERDTreeShowHidden=0
Digraph answered 27/3, 2016 at 13:38 Comment(1)
The problem is angular doens't build them with a . prefix.Sharpsighted

© 2022 - 2024 — McMap. All rights reserved.