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.

CommentFileSizeAuthor
#7 vimrc-taglist-1341778-9.patch713 bytesbenjifisher
#3 expected95.95 KBdkinzer
#3 actual60.55 KBdkinzer

Comments

benjifisher’s picture

Status: Active » Postponed (maintainer needs more info)

I 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.

kostajh’s picture

I 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.

dkinzer’s picture

Status: Postponed (maintainer needs more info) » Active
StatusFileSize
new60.55 KB
new95.95 KB

So after installing and enabling the TagList plugin I go to a view a php file and if I press \t I expect to see a list on the right hand column of all the functions and classes defined in that file:

Image of what to expect

But if I enable the Vim Plugin for Drupal, then the side panel is empty:

What actually happens.

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

benjifisher’s picture

@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?

dkinzer’s picture

Great.

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.)

dkinzer’s picture

@kostajh Thanks for the tagbar suggestion. It does look like it might work for me, so I'll give it a try.

benjifisher’s picture

Assigned: Unassigned » benjifisher
Status: Active » Needs review
StatusFileSize
new713 bytes

I 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

$ patch -p1 < vimrc-taglist-1341778-9.patch

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!)

  1. Ask Yegappan Lakshmanan to update the taglist plugin for vim 7.0. Doing it right would be a big job. He might do it for old times' sake if I ask.
  2. Add a bunch of declarations to our plugin telling taglist to treat php.drupal like php, javascript.drupal like javascript, etc. This has the advantage that it is code we control, but it is code duplication, hard to maintain, and we have to anticipate every file type.
  3. Recommend tagbar as an alternative to taglist. I need to get opinions from those of you who (unlike me) actually use these plugins.
dkinzer’s picture

@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

benjifisher’s picture

@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:

:help taglist-debug
:TlistDebug
:TlistUpdate
:TlistUndebug
:TlistMessages

and then look for a line like

09:59:38: Tlist_Process_File (/Users/benji/Sites/dgd7/drupal/sites/all/modules/multicolumn/multicolumn.module, php)

Without my patch, I think you should see php.drupal at the end of that line instead of just php.


Maybe you have two copies of taglist.vim on your system. You can see which one is being used with :scriptnames. Better yet,

:redir @a
:scriptnames
:redir END
:new
:put a
/taglist
dkinzer’s picture

Status: Needs review » Reviewed & tested by the community

@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).

benjifisher’s picture

Status: Reviewed & tested by the community » Closed (won't fix)

@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.

kelvinleehk’s picture

Version: » 7.x-1.x-dev

IMO 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.

benjifisher’s picture

@sourcesqr, I agree. I already recommend using Tagbar instead of Taglist on the recently-added documentation page http://drupal.org/node/1389472.

benjifisher’s picture

Issue summary: View changes

Added workarounds to issue summary.