tern icon indicating copy to clipboard operation
tern copied to clipboard

"dontLoad": "node_modules" by default

Open franciscolourenco opened this issue 8 years ago • 3 comments
trafficstars

Without "dontLoad": "node_modules" sublime beachballs indefinitely. Wouldn't it be a good idea to add this to the default options?

franciscolourenco avatar Apr 30 '17 21:04 franciscolourenco

Definitely not, since it breaks all completions for modules. What does your project look like?

marijnh avatar May 01 '17 08:05 marijnh

I had been using Atom for the past year, and occasionally Tern would crash, but it seemed to fail and not bring down the editor; whereas Sublime straight-up freezes.

Marijn is correct though - you don't want to disable autocompletion and tooltips for all your libraries.

This glob pattern will ignore everything except react, react-dom, and redux. You can add more - just separate each word with a pipe.

"dontLoad": [
  "**/node_modules/!(react*|redux)/**/*.js"
]

An array of glob patterns like that won't work though. For example:

"dontLoad": [
  "**/node_modules/!(react)/**/*.js",
  "**/node_modules/!(redux)/**/*.js"
]

Because they will cancel each other out and effectively not load anything in node_modules.

I've spent the past few hours Googling this and playing around with my .tern-project, and this seems to be working.

Oh yeah, thanks @marijnh for a great tool for us to use.

adamelliotfields avatar May 27 '17 04:05 adamelliotfields

@marijnh Actually my project was quite simple. Just a couple of packages.

If the solution is what @adamelliotfields suggested, then maybe ternjs could read package.json and only load packages listed there.

verysofttoiletpaper avatar May 27 '17 11:05 verysofttoiletpaper