[geany/geany] 877b04: Set scope information for JavaScript tags
Colomban Wendling
git-noreply at xxxxx
Fri Sep 21 23:27:11 UTC 2012
Branch: refs/heads/master
Author: Colomban Wendling <ban at herbesfolles.org>
Committer: Colomban Wendling <ban at herbesfolles.org>
Date: Fri, 21 Sep 2012 23:27:11
Commit: 877b0477c401e9c359cbf93e04989b7aeccc257e
https://github.com/geany/geany/commit/877b0477c401e9c359cbf93e04989b7aeccc257e
Log Message:
-----------
Set scope information for JavaScript tags
Instead of adding the scope to the tag name, properly add it as the
tag's scope.
Closes #3570192.
Modified Paths:
--------------
tagmanager/ctags/js.c
tagmanager/src/tm_tag.c
Modified: tagmanager/ctags/js.c
35 files changed, 12 insertions(+), 23 deletions(-)
===================================================================
@@ -212,7 +212,7 @@ static void deleteToken (tokenInfo *const token)
* Tag generation functions
*/
-static void makeConstTag (tokenInfo *const token, const jsKind kind)
+static void makeJsTag (tokenInfo *const token, const jsKind kind)
{
if (JsKinds [kind].enabled && ! token->ignoreTag )
{
@@ -225,31 +225,20 @@ static void makeConstTag (tokenInfo *const token, const jsKind kind)
e.kindName = JsKinds [kind].name;
e.kind = JsKinds [kind].letter;
- makeTagEntry (&e);
- }
-}
-
-static void makeJsTag (tokenInfo *const token, const jsKind kind)
-{
- vString * fulltag;
-
- if (JsKinds [kind].enabled && ! token->ignoreTag )
- {
- /*
- * If a scope has been added to the token, change the token
- * string to include the scope when making the tag.
- */
if ( vStringLength(token->scope) > 0 )
{
- fulltag = vStringNew ();
- vStringCopy(fulltag, token->scope);
- vStringCatS (fulltag, ".");
- vStringCatS (fulltag, vStringValue(token->string));
- vStringTerminate(fulltag);
- vStringCopy(token->string, fulltag);
- vStringDelete (fulltag);
+ jsKind parent_kind = JSTAG_CLASS;
+
+ /* if we're creating a function (and not a method),
+ * guess we're inside another function */
+ if (kind == JSTAG_FUNCTION)
+ parent_kind = JSTAG_FUNCTION;
+
+ e.extensionFields.scope[0] = JsKinds [parent_kind].name;
+ e.extensionFields.scope[1] = vStringValue (token->scope);
}
- makeConstTag (token, kind);
+
+ makeTagEntry (&e);
}
}
Modified: tagmanager/src/tm_tag.c
3 files changed, 2 insertions(+), 1 deletions(-)
===================================================================
@@ -154,7 +154,8 @@ gboolean tm_tag_init(TMTag *tag, TMSourceFile *file, const tagEntryInfo *tag_ent
tag->atts.entry.arglist = g_strdup(tag_entry->extensionFields.arglist);
if ((NULL != tag_entry->extensionFields.scope[1]) &&
(isalpha(tag_entry->extensionFields.scope[1][0]) ||
- tag_entry->extensionFields.scope[1][0] == '_'))
+ tag_entry->extensionFields.scope[1][0] == '_' ||
+ tag_entry->extensionFields.scope[1][0] == '$'))
tag->atts.entry.scope = g_strdup(tag_entry->extensionFields.scope[1]);
if (tag_entry->extensionFields.inheritance != NULL)
tag->atts.entry.inheritance = g_strdup(tag_entry->extensionFields.inheritance);
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: TBD).
More information about the Commits
mailing list