[geany/geany] 8289e8: Report scope including classes, namespaces and alike
Colomban Wendling
git-noreply at xxxxx
Mon Sep 17 20:51:36 UTC 2012
Branch: refs/heads/master
Author: Colomban Wendling <ban at herbesfolles.org>
Committer: Colomban Wendling <ban at herbesfolles.org>
Date: Mon, 17 Sep 2012 20:51:36
Commit: 8289e8f96289d0c4ca00231d1d2fa0e87179641f
https://github.com/geany/geany/commit/8289e8f96289d0c4ca00231d1d2fa0e87179641f
Log Message:
-----------
Report scope including classes, namespaces and alike
Don't only match the current function as the current scope, but also
classes, namespaces and others containers.
Closes #1996778.
Modified Paths:
--------------
src/symbols.c
src/symbols.h
src/ui_utils.c
Modified: src/symbols.c
14 files changed, 14 insertions(+), 0 deletions(-)
===================================================================
@@ -2204,6 +2204,20 @@ gint symbols_get_current_function(GeanyDocument *doc, const gchar **tagname)
}
+/* same as symbols_get_current_function() but finds class, namespaces and more */
+gint symbols_get_current_scope(GeanyDocument *doc, const gchar **tagname)
+{
+ guint tag_types = (tm_tag_function_t | tm_tag_method_t | tm_tag_class_t |
+ tm_tag_struct_t | tm_tag_enum_t | tm_tag_union_t);
+
+ /* Python parser reports imports as namespaces which confuses the scope detection */
+ if (doc && doc->file_type->lang != filetypes[GEANY_FILETYPES_PYTHON]->lang)
+ tag_types |= tm_tag_namespace_t;
+
+ return get_current_tag_name_cached(doc, tagname, tag_types);
+}
+
+
static void on_symbol_tree_sort_clicked(GtkMenuItem *menuitem, gpointer user_data)
{
gint sort_mode = GPOINTER_TO_INT(user_data);
Modified: src/symbols.h
2 files changed, 2 insertions(+), 0 deletions(-)
===================================================================
@@ -61,4 +61,6 @@ enum
gint symbols_get_current_function(GeanyDocument *doc, const gchar **tagname);
+gint symbols_get_current_scope(GeanyDocument *doc, const gchar **tagname);
+
#endif
Modified: src/ui_utils.c
2 files changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -272,7 +272,7 @@ static void add_statusbar_statistics(GString *stats_str,
g_string_append(stats_str, filetypes_get_display_name(doc->file_type));
break;
case 'S':
- symbols_get_current_function(doc, &cur_tag);
+ symbols_get_current_scope(doc, &cur_tag);
g_string_append(stats_str, cur_tag);
break;
default:
@@ Diff output truncated at 100000 characters. @@
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: TBD).
More information about the Commits
mailing list