wookiehangover / jshint.vim

JSHint fork of jslint.vim
Other
194 stars 45 forks source link

Bad interaction with Ack/Ag #42

Open micahwedemeyer opened 9 years ago

micahwedemeyer commented 9 years ago

I'm not sure what or why, but I was having problems with the ack.vim plugin and removing jshint.vim fixed it for me.

This describes the issue pretty well: https://github.com/mileszs/ack.vim/issues/82

I know that's not a lot of info to go on, but I thought you'd like to know.

ches commented 9 years ago

ack.vim maintainer here—from a brief look at it, it seems to me that jshint.vim really bogarts the quickfix list and is going to interact poorly with pretty much anything else that wants to use it.

The main function s:JSHint() populates the quickfix list whether or not there are any errors returned from jshint, plus s:JSHint() is called a lot: on BufEnter, InsertLeave, BufWritePost, and CursorHold (which means it runs periodically when Vim is left idle, default every 4 seconds) for JavaScript buffers.

So if I'm tracing everything correctly, basically this happens:

  1. You run a search with ack.vim, which by default uses the quickfix list for results.
  2. You navigate to another JS buffer, write a JS buffer, or just do nothing for 4 seconds.
  3. jshint.vim overwrites your quickfix list, possibly with an empty list.

This is just really aggressive use of what is a "shared resource" in Vim. I don't see a very good workaround except to try to configure jshint.vim to be far more conservative, and it looks like there isn't currently any option to disable the CursorHold callbacks. I'm sorry to say this, but I'd probably either add the needed additional configuration myself, or just switch to Syntastic's support for jshint.

mde commented 9 years ago

I just installed jshint.vim, and immediately tripped over this issue. Nice plugin here, but yeah.