[geany/geany] 7d116c: ruby: Report proper scope type
Colomban Wendling
git-noreply at xxxxx
Mon Mar 14 18:27:22 UTC 2016
Branch: refs/heads/master
Author: Colomban Wendling <ban at herbesfolles.org>
Committer: Colomban Wendling <ban at herbesfolles.org>
Date: Mon, 14 Mar 2016 18:27:22 UTC
Commit: 7d116cb4829d684864a0ab8319c688d523ca5d8c
https://github.com/geany/geany/commit/7d116cb4829d684864a0ab8319c688d523ca5d8c
Log Message:
-----------
ruby: Report proper scope type
Modified Paths:
--------------
tagmanager/ctags/ruby.c
Modified: tagmanager/ctags/ruby.c
12 lines changed, 11 insertions(+), 1 deletions(-)
===================================================================
@@ -170,6 +170,8 @@ static void emitRubyTag (vString* name, rubyKind kind)
{
tagEntryInfo tag;
vString* scope;
+ rubyKind parent_kind = K_UNDEFINED;
+ NestingLevel *lvl;
const char *unqualified_name;
const char *qualified_name;
@@ -179,6 +181,9 @@ static void emitRubyTag (vString* name, rubyKind kind)
vStringTerminate (name);
scope = nestingLevelsToScope (nesting);
+ lvl = nestingLevelsGetCurrent (nesting);
+ if (lvl)
+ parent_kind = lvl->type;
qualified_name = vStringValue (name);
unqualified_name = strrchr (qualified_name, SCOPE_SEPARATOR);
@@ -190,6 +195,8 @@ static void emitRubyTag (vString* name, rubyKind kind)
vStringPut (scope, SCOPE_SEPARATOR);
vStringNCatS (scope, qualified_name,
unqualified_name - qualified_name);
+ /* assume module parent type for a lack of a better option */
+ parent_kind = K_MODULE;
}
unqualified_name++;
}
@@ -198,7 +205,10 @@ static void emitRubyTag (vString* name, rubyKind kind)
initTagEntry (&tag, unqualified_name);
if (vStringLength (scope) > 0) {
- tag.extensionFields.scope [0] = "class";
+ Assert (0 <= parent_kind &&
+ (size_t) parent_kind < (sizeof RubyKinds / sizeof RubyKinds[0]));
+
+ tag.extensionFields.scope [0] = RubyKinds [parent_kind].name;
tag.extensionFields.scope [1] = vStringValue (scope);
}
tag.kindName = RubyKinds [kind].name;
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
More information about the Commits
mailing list