[Geany] Local Tags (was Re: Bunch of feature requests...)

Jiří Techet techet at xxxxx
Wed May 11 20:48:15 UTC 2011


On Wed, May 11, 2011 at 00:29, Matthew Brush <mbrush at codebrainz.ca> wrote:
> On 05/10/11 15:11, Jiří Techet wrote:
>
>> version of ctags as possible. I updated only the core parts of ctags,
>> not the parsers, because I know there have been many tunings made by
>> Geany to some of them. Recently I've rebased on top of the changes
>> made by Colomban (MIO introduction). I've also #if 0'd a lot of code
>> not needed by Geany so it's much clearer what's used by Geany and what
>> not (e.g. some of the Colomban's changes were completely useless
>> because they affected code that's never called in Geany). I've been
>
> Hi Jiří,
>
> Since you seem to know the TM code pretty well, I wonder if you'd like to
> help me (or tell me how to) add support for tags inside of functions for C
> (and similar languages).
>
> In a lousy attempt at doing this the other night, the first time I ever
> looked at the TM code, I managed to get all the function local variables
> into the Symbol sidebar tree, however, they all end up under the "Variables"
> node lumped all together and also included more than just variables (ie.
> func parameters,etc).  Ideally, I think the symbols should end up in the
> tree nested under the function where they are declared in.
>
> FWIW, the change I made to get the symbols in the Symbol treeview was
> here[1] by adding another fall-through case under 'case DECL_ENUM' for 'case
> DECL_FUNCTION'.
>
> Any hints or help would be much appreciated.
>
> P.S. Apologies if this has been discussed already, I don't know how to
> search the mailing list archives.
>
> [1] http://git.geany.org/geany/tree/tagmanager/c.c#n2838
>
> Cheers,
> Matthew Brush


Hi Matthew,

I'm not really an expert on the parsers themselves - as I wrote, in my
branch I updated everything except for the parsers (and did my best to
avoid the scary c.c in particular).

Anyway, I'll try to help with what I know. The function which passes
the information about the found tag to the tag manager is

void makeTagEntry (const tagEntryInfo *const tag);

and the tagEntryInfo struct contains all the necessary information
about the tag. In ctags this function writes a line into the tags
file; in Geany it passes the tag information to the tag manager which
builds the tree in the sidebar. I believe the information about
parents/children in the tree is determined by

const char* scope [2];

of tagEntryInfo. Have a look at addOtherFields() and
findScopeHierarchy() which are called from makeTag(). I believe that
if you update the scope for local variables to point to the function
they are declared in might do the trick. However I don't know anything
about tag manager itself (those files with tm_ prefix) so I'm not sure
if you'll need to update them as well or if updating c.c is enough.

Hope this helped at least a bit.

Cheers,

Jiri



More information about the Users mailing list