ternjs / tern_for_vim

Tern plugin for Vim
MIT License
1.83k stars 100 forks source link

Slow omnicompletion for object members #174

Open igemnace opened 7 years ago

igemnace commented 7 years ago

I have an object with multiple properties:

export const colors = {
  GREEN: '#7fad33',
  DARK_GREEN: '#04bb79',
  LIGHT_GREEN: '#b0cc7f',
};

When I type colors.<C-x><C-o> to omni-complete these properties, it takes a few good seconds to load the results. During this time, my editor is blocked and I cannot take any further actions. This happens for a 27-line file consisting of only two objects: colors and fonts.

My issue displays the same symptoms as #60, so I followed the steps in that issue first. Notably, I ran time bin/test from within my tern folder. The results are:

Ran 597 tests from 100 files.
All passed.
bin/test  12.42s user 0.37s system 116% cpu 11.007 total

On the other hand, the demo on http://ternjs.net/doc/demo.html works very quickly for me.

This happens with tern_for_vim running as the only completion plugin (no YouCompleteMe) so I cannot apply the same solution as in the linked issue.

From your instructions in that issue, I understand that the problem is on the node side. What steps can I take to correct this on my machine?

marijnh commented 7 years ago

Could you show the whole file that causes the slowdown? What does your .tern_project look like?

igemnace commented 7 years ago

I've uploaded the JS file and my .tern_config to Gist (I don't have a project-specific .tern_project): https://gist.github.com/igemnace/2c98d36aa41b15c487c6df706fed56e5