문제

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.

도움이 되었습니까?

해결책

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.

다른 팁

I had the same trouble recently and I have adopted and extended a ctags extractor for scala that works quite well with the tagbar plugin. Here it is the code:

https://github.com/luben/sctags

It is slower than exuberant-ctags because it uses the scalac parser and JVM has noticeable startup time but it gives a quite complete information.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top