atom-typescript: File globbing slow with large node_modules folder

Atom Typescript adds the following filesGlob to tsconfig.json by default:

"./**/*.ts",
"!./node_modules/**/*.ts"

This indeed excludes things from node_modules, but it apparently still causes the full node_modules folder to be traversed.

I’ve tried replacing the second line with "./node_modules/**" and "./node_modules/" in order to prevent it from entering the directory at all, but that didn’t seem to help (or didn’t work at all).

We have a very large number of node modules in this particular tree, which makes Atom very slow for many operations (adding a file, renaming) and causes frequent hickups while editting. Haven’t timed it exactly, but it’s in the order of tens of seconds before e.g. a save of tsconfig.json ‘notices’ added or removed files.

As an experiment, I moved the tsconfig.json to the subdir that actually contains the TS code (which doesn’t have a node_modules dir), and now saving tsconfig,json is ‘just’ a second or two (it’s a fairly large codebase).

Somewhat related to #217, which also got slow due to traversing large number of directories.

Is there e.g. a different glob pattern that may help?

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 28 (5 by maintainers)

Most upvoted comments

@TTTee try adding

  "filesGlob": [
    "main.ts",
    "typings.d.ts",
    "app/**/*.ts",
    "!app/**/*.spec.ts"
  ]

to tsconfig.json file.

Also running into this issue. Was comparing my TS experience between Atom and VSC and it’s pretty much unusable in Atom at the moment. As everyone says, I try to get autocomplete on something and it’ll queue up requests for getProjectFileDetails and errorsForFile into the hundreds.

The tsconfig.json is inside /src as was suggested here. In fact, to reproduce is quite simple

Just a thought, but with TypeScript 2.0 coming soon, maybe “filesGlob” and calculating the “files” property should be deprecated.

So if your tsconfig.json has “include”, Atom-Typescript goes into TypeScript 2.0 mode https://github.com/Microsoft/TypeScript-Handbook/blob/master/pages/tsconfig.json.md

Would this be an easier/better solution?


I’m using TypeScript 2.0.2 and atom-typescript 10.1.6 I found that adding filesGlob (in addition to include and exclude) improved my rebuild time from 13 seconds to 5 seconds. (click the refresh icon in the TypeScript panel) tsc in the terminal takes 4 seconds.

tsconfig.json

  "include": [
    "app/assets/**/*.ts"
  ],
  "exclude": [
    "node_modules",
    "target"
  ],
  "filesGlob" : [
    "app/assets/**/*.ts",
    "!node_modules/**",
    "!target/**",
  ]

Note: paths are weird because I’m working on a Play project.