Skip to content

Commit

Permalink
Ignore local tags for autocompletion in other files
Browse files Browse the repository at this point in the history
ctags sets the tag's "local" flag to true for tags whose visibility is
limited to the current file only. These are for instance "static" functions
in C.

We can ignore these tags for autocompletion in other files than the
tag's file which reduces the number of irrelevant tags in the
autocompletion popup.
  • Loading branch information
techee committed Aug 29, 2022
1 parent 5cdfe35 commit 10fba80
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/tagmanager/tm_workspace.c
Expand Up @@ -637,7 +637,12 @@ gboolean tm_workspace_is_autocomplete_tag(TMTag *tag,
(current_file == tag->file &&
current_line >= tag->line &&
g_strcmp0(current_scope, tag->scope) == 0);
return valid && !tm_tag_is_anon(tag) && tm_parser_langs_compatible(lang, tag->lang);

/* tag->local indicates per-file-only visibility such as static C functions */
gboolean valid_local = !tag->local || current_file == tag->file;

return valid && valid_local &&
!tm_tag_is_anon(tag) && tm_parser_langs_compatible(lang, tag->lang);
}


Expand Down

0 comments on commit 10fba80

Please sign in to comment.