The taglist plugin is a pretty cool plugin that lists a php files classes, functions and variables on a side panel. It's one of a handy set of vim plugins that combined make vim look and feel more like a modern day IDE.
Anyway, if I install and enable this drupal-vim plugin on my environment, it breaks taglist plugin.
Workarounds
The problem is that the taglist plugin does not expect multiple filetypes, such as php.drupal. (Multiple filetypes were introduced in vim 7.0. The taglist plugin was written for vim 6.x and was never updated for vim 7.0.)
One workaround is to use the tagbar plugin instead of taglist. (You can also find it on GitHub.)
Another option is to patch the taglist plugin. See comment #7 below for instructions.
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | vimrc-taglist-1341778-9.patch | 713 bytes | benjifisher |
| #3 | expected | 95.95 KB | dkinzer |
| #3 | actual | 60.55 KB | dkinzer |
Comments
Comment #1
benjifisherI know that the taglist plugin has been around for a long time, but I have never tried it. Please give a specific sequence of steps that leads to a problem. I cannot start debugging unless I know what is supposed to happen and does not.
Comment #2
kostajh commentedI had the same problem. If the filetype is set to "drupal" then the list of functions and variables won't appear in the taglist sidebar. I'm nto sure if this is fixed now that the filetype is set to "php.drupal". I switched to using Tagbar which works just fine with the Drupal plugin.
Comment #3
dkinzer commentedSo after installing and enabling the TagList plugin I go to a view a php file and if I press
\tI expect to see a list on the right hand column of all the functions and classes defined in that file:But if I enable the Vim Plugin for Drupal, then the side panel is empty:
My .vim config is public at https://github.com/dkinzer/.vim , So your're welcome to download and reproduce the problem simply by enabling and disabling your module.
To to enable the vim plugin for drupal, just comment out line 137 of my .vimrc
Comment #4
benjifisher@dkinzer:
Thanks, that is helpful. It may be a few days before I have time to look at it.
Will TagList work with any version of ctags or does it require Exuberant Ctags?
Comment #5
dkinzer commentedGreat.
It requires exuberant ctags (though that may be the default these days because I don't remember needing to install anything else to get to work.)
Comment #6
dkinzer commented@kostajh Thanks for the tagbar suggestion. It does look like it might work for me, so I'll give it a try.
Comment #7
benjifisherI think that @kostajh was right in #2 above. The taglist plugin was last updated before vim 7.0 came out, so it does not expect multiple filetypes such as php.drupal. Thanks, that made it much easier for me to debug.
My Mac has some other version of ctags installed in /usr/bin, so I compiled Exuberant Ctags, put it in /usr/local/vim, and told taglist to look there. I found instructions on http://adamyoung.net/Exuberant-Ctags-OS-X, which looks like a Drupal site to me. Maybe @adamtyoung on d.o?
Please try the attached patch. Unless you have taglist.vim under version control, you should apply this with
in the same directory as taglist.vim. The patch tells taglist that if there are multiple filetypes, it should only look at the first. Thus it treats php.drupal or php.drupal.foo the same as php.
We have several options. (I do not guarantee that I have thought of all!)
Comment #8
dkinzer commented@benjifisher, I tried that patch (thanks). But, it didn't work for me.
BTW I forked taglist to apply your patch @ https://github.com/dkinzer/taglist.vim
I'm thinking if this is really a taglist issues there is no need to do further work, and the recommendation should be for people to try other modules.
I'll let others weigh in on it, but I'm fine if you close the issue.
Thanks!
D
Comment #9
benjifisher@dkinzer, I hate it when results are not reproducible. :-(
Hm, why did I name the patch -9? Even smart people make dumb mistakes ...
If you have used both taglist and tagbar and are satisfied with either, then I think it is good enough to recommend that people use the one that works OOTB. Still, some people will already have taglist installed, so it would be nice to get a working patch, even if we have to point people to this issue. If we can do that, then I will edit the issue summary and call it fixed.
Would you mind checking manually that the patch worked? (It is a very small patch.) Are you sure that you restarted vim after applying the patch? If it is still not working, it would help if you could do the following:
and then look for a line like
Without my patch, I think you should see
php.drupalat the end of that line instead of justphp.Maybe you have two copies of taglist.vim on your system. You can see which one is being used with
:scriptnames. Better yet,Comment #10
dkinzer commented@benjifisher, sorry my mistake. Your patch works perfectly. The problem was that the submodule repo was pointing to a headless branch not the new master with your changes. (Sorry. I've just only started using Git submodules and I'm still getting used to their particular quirks).
Comment #11
benjifisher@dkinzer, no worries. I have made mistakes with git, too. As git mistakes go, this one was pretty harmless. Did you learn anything from my debugging suggestions in #9?
I have mentioned the two workarounds in the issue summary, so I am marking this issue as closed (won't fix). I think that is more accurate than calling it fixed.
Comment #12
kelvinleehk commentedIMO Taglist is crippled in many ways anyway, now using Tagbar instead thanks to the suggestion in #6. It's been working wonder :). It's not that much different anyway when using it with PHP syntax / scopes anyway.
Comment #13
benjifisher@sourcesqr, I agree. I already recommend using Tagbar instead of Taglist on the recently-added documentation page http://drupal.org/node/1389472.
Comment #13.0
benjifisherAdded workarounds to issue summary.