Tuesday, February 22, 2011

Re: Tagbar: a Taglist-like plugin that can handle scopes like classes etc.

Karol Samborski <edv.karol@gmail.com>:
> 2011/2/22 Jan Larres <lists@majutsushi.net>:
>> yes, that would certainly be handy. Unfortunately ctags doesn't provide
>> this information, so I can't do anything about it in Tagbar. Someone
>> would have to extend ctags first, then I could use it in Tagbar.
>
> hmm... in my tags file generated by ctags there is for example:
> BrowseDialog::lSetRecord
> /home/karol.samborski/workspace/kfw/framework/include/dialog.h /^
> long lSetRecord;$/;" m class:BrowseDialog access:protected
>
> so I think it's possible...
> I generated my tags file like this:
> ctags -R --sort=yes --c++-kinds=+p --fields=+iaS --extra=+q
> --language-force=C++ -f tags path

Unfortunately it's not that easy. The type only appears in the search
pattern of the tag, it doesn't get extracted by ctags into a usable
format. That means I would have to basically parse the line myself with
a different parser for (almost) every language, something that ctags is
already supposed to do. Since there can be many complications in a type
declaration with modifiers like 'extern', 'static' etc. in arbitrary
order, some languages having the type after the name instead of before
it, more than one declaration in a line and even macros that can
basically do what they want there is really no other way around it if
you don't want it to be wrong half of the time. Therefore it would make
a lot more sense to add this functionality to ctags directly as an
additional field, displaying this field in Tagbar would then be almost
trivial.

> Another little thing is that there is no information about what
> function returns.

Here the same thing applies as above, with the additional problem that
at least in C and C++ it's somewhat common to put the return type on a
line above the function/method name meaning that it doesn't even appear
in the search pattern. So in that case I would have no way at all to
discover it.

> I hope this helps.

I hope my answer helps with understanding the problems :). I would love
to be able to display this information, but without the help of ctags
it's not really feasible.

Cheers,
Jan

--
-[ OpenPGP key ID: 00A0FD5F ]-
I will permit no man to narrow and degrade my soul by making me hate him.
-- Booker T. Washington

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: