Branch: refs/heads/master Author: Colomban Wendling ban@herbesfolles.org Committer: Colomban Wendling ban@herbesfolles.org Date: Sat, 07 Oct 2023 15:59:45 UTC Commit: 57631f1e1b82d7c4068e1c5cdcdb6e9b0e91e190 https://github.com/geany/geany/commit/57631f1e1b82d7c4068e1c5cdcdb6e9b0e91e1...
Log Message: ----------- Merge pull request #3490 from techee/local_fix
Mark tags as "local" only for files with a known C/C++ source extension
Modified Paths: -------------- src/tagmanager/tm_ctags.c src/tagmanager/tm_source_file.c src/tagmanager/tm_source_file.h
Modified: src/tagmanager/tm_ctags.c 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -119,7 +119,7 @@ static gboolean init_tag(TMTag *tag, TMSourceFile *file, const tagEntryInfo *tag
tag->name = g_strdup(tag_entry->name); tag->type = type; - tag->local = tag_entry->isFileScope; + tag->local = tag_entry->isFileScope && file->trust_file_scope; tag->flags = tm_tag_flag_none_t; if (isTagExtraBitMarked(tag_entry, XTAG_ANONYMOUS)) tag->flags |= tm_tag_flag_anon_t;
Modified: src/tagmanager/tm_source_file.c 19 lines changed, 19 insertions(+), 0 deletions(-) =================================================================== @@ -609,6 +609,25 @@ static gboolean tm_source_file_init(TMSourceFile *source_file, const char *file_ else source_file->lang = tm_ctags_get_named_lang(name);
+ source_file->trust_file_scope = TRUE; + + if (source_file->lang == TM_PARSER_C || source_file->lang == TM_PARSER_CPP) + { + const gchar **ext; + const gchar *common_src_exts[] = + {".c", ".C", ".cc", ".cp", ".cpp", ".cxx", ".c++", ".CPP", ".CXX", NULL}; + + source_file->trust_file_scope = FALSE; + for (ext = common_src_exts; *ext; ext++) + { + if (g_str_has_suffix(source_file->short_name, *ext)) + { + source_file->trust_file_scope = TRUE; + break; + } + } + } + return TRUE; }
Modified: src/tagmanager/tm_source_file.h 1 lines changed, 1 insertions(+), 0 deletions(-) =================================================================== @@ -35,6 +35,7 @@ typedef struct TMSourceFile char *file_name; /**< Full file name (inc. path) */ char *short_name; /**< Just the name of the file (without the path) */ GPtrArray *tags_array; /**< Sorted tag array obtained by parsing the object. @elementtype{TMTag} */ + gboolean trust_file_scope; } TMSourceFile;
GType tm_source_file_get_type(void);
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).