Skip to content

Commit

Permalink
Update mappings in tm_parser.c
Browse files Browse the repository at this point in the history
The new parser generates 2 tags for import statements like

from A import B

For A tag of the 'i' kind is generated, for B, tag of the kind 'x' is
generated. B includes A in its scope and when we omit generation of
'i', imports are printed in the sidebar with the full scope information
like

Imports
    django.views.decorators.csrf.csrf_exempt
    django.views.decorators.csrf.csrf_exempt2
    django.views.decorators.http.require_POST

When we generate 'i' and map it to something (I used tm_tag_externvar_t
like for the imports themselves, there's nothing in the tag types
we have that would be a good semantic candidate here), the result
in the sidebar is

Imports
    django.views.decorators.csrf
        csrf_exempt
        csrf_exempt2
    django.views.decorators.http
        require_POST

which is more readable IMO.
  • Loading branch information
techee committed Mar 14, 2022
1 parent 37f76c9 commit 83c0439
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/tagmanager/tm_parser.c
Expand Up @@ -136,9 +136,13 @@ static TMParserMapEntry map_PYTHON[] = {
{'f', tm_tag_function_t},
{'m', tm_tag_method_t},
{'v', tm_tag_variable_t},
{'I', tm_tag_undef_t},
{'i', tm_tag_externvar_t},
/* defined as externvar to get those excluded as forward type in symbols.c:goto_tag()
* so we can jump to the real implementation (if known) instead of to the import statement */
{'x', tm_tag_externvar_t},
{'z', tm_tag_undef_t},
{'l', tm_tag_undef_t},
};

/* different parser than tex.c from universal-ctags */
Expand Down

0 comments on commit 83c0439

Please sign in to comment.