xolox / vim-easytags

Automated tag file generation and syntax highlighting of tags in Vim
http://peterodding.com/code/vim/easytags/
1.01k stars 109 forks source link

Freshly installed plugin, getting 'unreasonably low value' even when setting it to 1000000 #47

Closed oryband closed 11 years ago

oryband commented 11 years ago

I just installed this plugin, and keep getting

easytags.vim 3.3: The 'updatetime' option has an unreasonably low value, so I'll start compensating (see the easytags_updatetime_min option).

I tried setting this:

let g:easytags_updatetime_min = 4000

Or to a even higher value, i.e. 100000 and what not, and I keep getting this warning every time. This even happens I if disable the plugin using:

let g:easytags_auto_update = 0  " Disable auto-update.
let g:easytags_auto_highlight = 0

And idea what's wrong?

xolox commented 11 years ago

The plug-in shows this message once, the first time it notices the low value of the 'updatetime' option. So when you say you "keep getting" the message, you mean each time you start Vim, right?

As the message says, the plug-in notices the low value, doesn't like it, but will compensate. In other words, you don't necessarily have to do anything. What problem are you trying to fix?

This even happens I if disable the plugin

This is a proper bug, so I'll fix it. Thanks for reporting it!

xolox commented 11 years ago

This even happens I if disable the plugin

This is now fixed, thanks for reporting it.

Freshly installed plugin, getting 'unreasonably low value' even when setting it to 1000000

I just reread the issue title and realized the vim-easytags plug-in (by proxy me :-) and you are miscommunicating:

You are changing the value of the g:easytags_updatetime_min option, expecting it to change (remove) the warning message, but the warning message is caused by Vim's internal 'updatetime' option. The g:easytags_updatetime_min option is only there to compensate for the low value of 'updatetime'. I just reread the documentation of the vim-easytags plug-in and I suppose this can be clarified further.

xolox commented 11 years ago

Can you take another look at the documentation? I just changed it to include a better explanation of what the underlying cause of the warning message is. I've also added a new option called g:easytags_updatetime_warn: If you set this option to 0 (false) in your vimrc script, the warning message will never be shown.

I'm closing this issue now because I believe the additional option and clarifications to the documentation should resolve your problem. If they do not, feel free to reopen this issue. Thanks for your feedback!

oryband commented 11 years ago

I read the updated docs. Thanks for the thorough explanation and fix. :)

So, what you're saying is that g:easytags_updatetime_min can only be used for lower values than 4000? Putting higher values doesn't do anything?

xolox commented 11 years ago

You can put anything you want in g:easytags_updatetime_min (minimum: 1 second, so 1000 milliseconds) and it will work, but the default value is there to "protect users against themselves" and probably shouldn't be lowered. Probably you would only change g:easytags_updatetime_min if you changed Vim's 'updatetime' option as well.

The easytags plug-in expects to be executed automatically every now and then, but other Vim plug-ins sometimes change Vim's settings so that the easytags plug-in is called several times a second instead. This is too much, it's not useful and it can slow Vim down immensely.

This problem of automatically running the easytags plug-in several times a second used to happen to a lot of users and I got a lot of bug reports because of it. Eventually I fixed this problem (see 43ae6d7b7195517a9b91dc19464c2ff9112ccb55 for the change and references) as follows:

  1. When the easytags plug-in is automatically executed, it first checks whether Vim's 'updatetime' option is set lower than g:easytags_updatetime_min. If this is the case, the plug-in will show a warning message once and then start compensating.
  2. The compensation works as follows: The easytags plug-in keeps track of the time it was last executed. Based on this it can calculate how much time has passed since the last time it was executed. If the number of milliseconds is lower than g:easytags_updatetime_min, the plug-in does nothing.
  3. Step 2 keeps repeating until the number of milliseconds is bigger than or equal to g:easytags_updatetime_min, at which point the plug-in will update & highlight your tags.

So if you or a Vim plug-in you're using has lowered the value of Vim's 'updatetime' option, the default value of g:easytags_updatetime_min will prevent the easytags plug-in from running multiple times a second. You could lower the value of g:easytags_updatetime_min as well, but then you're disabling a mechanism which is there for a reason...

oryband commented 11 years ago

Thanks for the thorough explanation. :)

chiphogg commented 11 years ago

Wait... so, if the plugin now compensates for the small 'updatetime', why even bother warning the user?

xolox commented 11 years ago

While developing my Vim plug-ins I get a kind of instinct for features that will work fine (robust, reliable, fool proof) and require no further explanation to any users versus features that will surprise users, trigger questions, bug reports, etc.

When I added the compensation code and it was brand new, I was sure it would fall in the second category (for the record: that was true) so I added a warning message to alert users that the compensation was activating. However that's not to say that the warning message should stay; clearly it can cause some confusion in and of itself :-)

chiphogg commented 11 years ago

Ah, now I can see how a user might get confused: maybe they set a really low 'updatetime' value and noticed easytags wasn't updating that quickly.

Overall, I think I'd rather see the warning message go, but I don't feel as strongly as I once did: it's much better now that it's a one-time message! :)