tags:

views:

222

answers:

1

I'm having trouble getting the taglist plugin working properly with Scala. I've installed the plugin and ctags and verified that it works properly with Java and C++. I then followed the instructions on this page (minus the Lift specific instructuions), but was nothing shows up in the taglist window when I open it while editing a Scala file. Has anyone got this working and what are the proper steps? Thanks.

+2  A: 

First check that your tags file has something in it. If you have followed the instructions on the page you mention, it should correctly identify classes, methods, etc. If that has worked then you can go to the next step.

The taglist plugin has a hardcoded list of supported language settings and Scala is not amongst them. So even if CTags generates the correct tags, the plugin will not read them in for this filetype.

It should be possible to add a definition as a global variable g:tlist_def_<lang>_settings, but I haven't been able to get that to work. So you have to modify the taglist.vim file in your ~/.vim/plugin directory to add Scala support. Don't worry, this is easy to do!

Search for the line that defines s:tlist_def_yacc_settings and add the following couple of lines after it:

let s:tlist_def_scala_settings = 'scala;t:trait;c:class;T:type;' .
                      \ 'm:method;C:constant;l:local;p:package;o:object'

Now when you hit Ctrl-T you should see your generated Scala tags in the Tag List window.

rq
I think you have got me a lot closer. I can now use :tag LiftSession (from the examples) to jump to that file and other files in the project. But Ctrl-T always returns 'E73: Tag list empty'. :TlistToggle is always empty as well. I'm up voting your answer since it is helpful.
Eric Hauser
Very odd - maybe the tags file format is off somehow? I've tried with the most "recent" (albeit from 2007) taglist plugin and with ctags 2.7 and 2.8, and those work with TlistToggle. The only difference is that the Scala files I have don't make use of Lift.
rq
Just tried this with ctags 2.7, and the latest lift RC 2.0, and it works pretty well. Maybe another ctags option has snuck into your .ctags file?
rq
That most have been the case. I cleaned out my .ctags file, just using the Scala settings and it works fine now using TlistToggle. Ctrl-T returns 'tag stack empty' but that's ok. Thanks!
Eric Hauser
Glad to hear you got it sorted!
rq