Closed luben closed 9 years ago
Thanks! For me personally I think the overhead of JVM start-up might be too much for me to want to use this for Tagbar, but I'd certainly try it for generating project-wide tags files.
Anyway, I'm definitely on board with the spirit of this change, allowing this aspect of the Tagbar integration to be configured. However, I think there are a few problems:
g:tagbar_ctags_bin
is global for all filetypes. We should be changing this only within the scope of the g:tagbar_type_scala
dictionary.sctags
installed—as mentioned above, I might want to use it for generating tags files but I might feel it's too sluggish for Tagbar.So at first I thought, "what if we just provided a g:scala_tagbar_ctags_bin
option which, if set, would cause g:tagbar_type_scala.ctagsbin
to be set to the custom value? That way, if any alternative tool is developed in the future, users can easily choose to use it without needing another change to vim-scala."
But then I wondered, what would be the point of the extra indirection? Why couldn't we just direct users to set g:tagbar_type_scala.ctagsbin
directly if they wish? So I pose that question to you: does that solve your need?
It will have to be set in a ~/.vim/after/ftplugin/scala.vim
file or autocmd FileType scala
, since if it were just set plainly in ~/.vimrc
vim-scala would load later and overwrite it (the entire g:tagbar_type_scala
dictionary).
So I cleaned some things up in our ctags/Tagbar configs in the commit referenced above—apologies that you'll need to rebase, but I think it gives you a more sensible base to work with.
I kept your labels of C
and O
for case classes and case objects, respectively, since they're more logical than what we had IMO, and hopefully that fits sctags
defaults seamlessly. Also folded the values/variables groups by default.
I removed the kind2scope
/scope2kind
values completely, since they're really meaningless if the tag generation doesn't support scopes, I think they were just cargo-culted. The organization in Tagbar looks/functions better without those settings if there is no scope info to use. You can of course put these back with appropriate values for what sctags supports.
This might be an argument in favor of the g:scala_tagbar_ctags_bin
option idea from above, since it would allow us to do this within the plugin:
if get(g:, 'scala_tagbar_ctags_bin', '') ==# 'sctags'
let g:tagbar_type_scala.kind2scope = " appropriate values for sctags scope labels
endif
Yes, it is a lot cleaner that way. I will provide config instructions in the sctags readme
It gives much better results with proper nesting and scoping Available from https://github.com/luben/sctags