Move tm_get_current_tag() from tm_workspace to tm_tag
This function has nothing to do with the workspace so it rather belongs to tm_tag.
This commit is contained in:
parent
71cc1ecb20
commit
f35d0b9c0c
@ -1126,6 +1126,47 @@ TMTag **tm_tags_find(const GPtrArray *tags_array, const char *name,
|
||||
return (TMTag **) result;
|
||||
}
|
||||
|
||||
/* Returns TMTag which "own" given line
|
||||
@param line Current line in edited file.
|
||||
@param file_tags A GPtrArray of edited file TMTag pointers.
|
||||
@param tag_types the tag types to include in the match
|
||||
@return TMTag pointers to owner tag. */
|
||||
const TMTag *
|
||||
tm_get_current_tag (GPtrArray * file_tags, const gulong line, const TMTagType tag_types)
|
||||
{
|
||||
TMTag *matching_tag = NULL;
|
||||
if (file_tags && file_tags->len)
|
||||
{
|
||||
guint i;
|
||||
gulong matching_line = 0;
|
||||
|
||||
for (i = 0; (i < file_tags->len); ++i)
|
||||
{
|
||||
TMTag *tag = TM_TAG (file_tags->pdata[i]);
|
||||
if (tag && tag->type & tag_types &&
|
||||
tag->line <= line && tag->line > matching_line)
|
||||
{
|
||||
matching_tag = tag;
|
||||
matching_line = tag->line;
|
||||
}
|
||||
}
|
||||
}
|
||||
return matching_tag;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* Returns TMTag to function or method which "own" given line
|
||||
@param line Current line in edited file.
|
||||
@param file_tags A GPtrArray of edited file TMTag pointers.
|
||||
@return TMTag pointers to owner function. */
|
||||
static const TMTag *
|
||||
tm_get_current_function (GPtrArray * file_tags, const gulong line)
|
||||
{
|
||||
return tm_get_current_tag (file_tags, line, tm_tag_function_t | tm_tag_method_t);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef TM_DEBUG /* various debugging functions */
|
||||
|
||||
/*
|
||||
|
@ -183,6 +183,8 @@ TMTag **tm_tags_find(const GPtrArray *tags_array, const char *name,
|
||||
|
||||
void tm_tags_array_free(GPtrArray *tags_array, gboolean free_all);
|
||||
|
||||
const TMTag *tm_get_current_tag(GPtrArray *file_tags, const gulong line, const TMTagType tag_types);
|
||||
|
||||
void tm_tag_unref(TMTag *tag);
|
||||
|
||||
TMTag *tm_tag_ref(TMTag *tag);
|
||||
|
@ -834,35 +834,6 @@ tm_workspace_find_scoped (const char *name, const char *scope, TMTagType type,
|
||||
}
|
||||
|
||||
|
||||
/* Returns TMTag which "own" given line
|
||||
@param line Current line in edited file.
|
||||
@param file_tags A GPtrArray of edited file TMTag pointers.
|
||||
@param tag_types the tag types to include in the match
|
||||
@return TMTag pointers to owner tag. */
|
||||
const TMTag *
|
||||
tm_get_current_tag (GPtrArray * file_tags, const gulong line, const TMTagType tag_types)
|
||||
{
|
||||
TMTag *matching_tag = NULL;
|
||||
if (file_tags && file_tags->len)
|
||||
{
|
||||
guint i;
|
||||
gulong matching_line = 0;
|
||||
|
||||
for (i = 0; (i < file_tags->len); ++i)
|
||||
{
|
||||
TMTag *tag = TM_TAG (file_tags->pdata[i]);
|
||||
if (tag && tag->type & tag_types &&
|
||||
tag->line <= line && tag->line > matching_line)
|
||||
{
|
||||
matching_tag = tag;
|
||||
matching_line = tag->line;
|
||||
}
|
||||
}
|
||||
}
|
||||
return matching_tag;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
find_scope_members_tags (const GPtrArray * all, GPtrArray * tags,
|
||||
const langType langJava, const char *name,
|
||||
@ -1142,17 +1113,6 @@ void tm_workspace_dump(void)
|
||||
|
||||
#if 0
|
||||
|
||||
/* Returns TMTag to function or method which "own" given line
|
||||
@param line Current line in edited file.
|
||||
@param file_tags A GPtrArray of edited file TMTag pointers.
|
||||
@return TMTag pointers to owner function. */
|
||||
static const TMTag *
|
||||
tm_get_current_function (GPtrArray * file_tags, const gulong line)
|
||||
{
|
||||
return tm_get_current_tag (file_tags, line, tm_tag_function_t | tm_tag_method_t);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
find_namespace_members_tags (const GPtrArray * all, GPtrArray * tags,
|
||||
const langType langJava, const char *name,
|
||||
|
@ -68,8 +68,6 @@ const GPtrArray *tm_workspace_find_scope_members(const GPtrArray *file_tags,
|
||||
gboolean find_global,
|
||||
gboolean no_definitions);
|
||||
|
||||
const TMTag *tm_get_current_tag(GPtrArray *file_tags, const gulong line, const TMTagType tag_types);
|
||||
|
||||
void tm_workspace_update_source_file_buffer(TMSourceFile *source_file, guchar* text_buf,
|
||||
gint buf_size);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user