Enable local tag generation for C/C++

Enable generating these tags both for local variables and function
parameters - those are more or less identical for what we will be using
local tags for so they can be mapped to the same type.

Local tags aren't interesting for tag files so filter them out when
generating these (but this also means that we cannot create unit tests
for them).
This commit is contained in:
Jiří Techet 2022-04-17 22:46:15 +02:00
parent 8ff56a5c77
commit d5cc1d05fb
3 changed files with 8 additions and 5 deletions

View File

@ -1133,7 +1133,7 @@ gboolean symbols_recreate_tag_list(GeanyDocument *doc, gint sort_mode)
g_return_val_if_fail(DOC_VALID(doc), FALSE);
tags = get_tag_list(doc, tm_tag_max_t);
tags = get_tag_list(doc, ~tm_tag_local_var_t);
if (tags == NULL)
return FALSE;

View File

@ -70,8 +70,8 @@ static GHashTable *subparser_map = NULL;
{'v', tm_tag_variable_t}, /* variable */ \
{'x', tm_tag_externvar_t}, /* externvar */ \
{'h', tm_tag_undef_t}, /* header */ \
{'l', tm_tag_undef_t}, /* local */ \
{'z', tm_tag_undef_t}, /* parameter */ \
{'l', tm_tag_local_var_t}, /* local */ \
{'z', tm_tag_local_var_t}, /* parameter */ \
{'L', tm_tag_undef_t}, /* label */ \
{'D', tm_tag_undef_t}, /* macroparam */
@ -89,7 +89,7 @@ static TMParserMapGroup group_C[] = {
{_("Structs"), TM_ICON_STRUCT, tm_tag_union_t | tm_tag_struct_t},
{_("Typedefs / Enums"), TM_ICON_STRUCT, tm_tag_typedef_t | tm_tag_enum_t},
{_("Macros"), TM_ICON_MACRO, tm_tag_macro_t | tm_tag_macro_with_arg_t},
{_("Variables"), TM_ICON_VAR, tm_tag_variable_t | tm_tag_enumerator_t},
{_("Variables"), TM_ICON_VAR, tm_tag_variable_t | tm_tag_enumerator_t | tm_tag_local_var_t},
{_("Extern Variables"), TM_ICON_VAR, tm_tag_externvar_t},
{_("Other"), TM_ICON_OTHER, tm_tag_other_t},
};

View File

@ -580,6 +580,7 @@ gboolean tm_workspace_create_global_tags(const char *pre_process, const char **i
TMSourceFile *source_file;
GList *includes_files;
gchar *temp_file = create_temp_file("tmp_XXXXXX.cpp");
GPtrArray *filtered_tags;
if (!temp_file)
return FALSE;
@ -624,7 +625,9 @@ gboolean tm_workspace_create_global_tags(const char *pre_process, const char **i
}
tm_tags_sort(source_file->tags_array, global_tags_sort_attrs, TRUE, FALSE);
ret = tm_source_file_write_tags_file(tags_file, source_file->tags_array);
filtered_tags = tm_tags_extract(source_file->tags_array, ~tm_tag_local_var_t);
ret = tm_source_file_write_tags_file(tags_file, filtered_tags);
g_ptr_array_free(filtered_tags, TRUE);
tm_source_file_free(source_file);
cleanup: