codi.vim icon indicating copy to clipboard operation
codi.vim copied to clipboard

Throws errors when Tern is installed

Open spinningarrow opened this issue 8 years ago • 6 comments

I don't know if this is an issue with Codi or TernJS, but I often see errors like this while I'm typing:

screen shot 2016-08-19 at 5 37 53 pm

Any idea what could be causing them and how to fix it?

spinningarrow avatar Aug 19 '16 12:08 spinningarrow

That's interesting - how consistently and with what frequency does this issue happen? Is it with every keystroke, or seemingly at random on some keystrokes? My suspicion that the asynchronous buffer switching that Codi does is interrupting the tern_sendBufferIfDirty call. In the event where the buffer switches at, for example, this line of code, it's impossible to guarantee correctness, as there is no way for Codi to acquire a communal lock with any other plugin.

metakirby5 avatar Aug 19 '16 19:08 metakirby5

It's seemingly at random on some keystrokes. Perhaps it's worth disabling Tern when Codi is enabled.

spinningarrow avatar Aug 22 '16 16:08 spinningarrow

I'll take a closer look when I get the chance, but it is unlikely that this issue will be fixed. If anything, I'll add a warning about the asynchronous buffer switching Codi does behind the scenes to the documentation.

metakirby5 avatar Aug 22 '16 23:08 metakirby5

Sure. Thanks for the useful plugin!

spinningarrow avatar Aug 23 '16 10:08 spinningarrow

Hey, it just occurred to me - have you tried using Tern + Codi with g:codi#sync = 1? This might "fix" the problem, in the sense that it will work with synchronous code.

metakirby5 avatar Sep 09 '16 02:09 metakirby5

Nope, I haven't tried that yet - let me do that and get back to you.

spinningarrow avatar Sep 09 '16 03:09 spinningarrow