Move symbols_get_context_separator() implementation to TM
This way we can use it inside TM.
This commit is contained in:
parent
e13aac0dea
commit
13755122f2
@ -322,31 +322,7 @@ GString *symbols_find_typenames_as_string(gint lang, gboolean global)
|
||||
GEANY_API_SYMBOL
|
||||
const gchar *symbols_get_context_separator(gint ft_id)
|
||||
{
|
||||
switch (ft_id)
|
||||
{
|
||||
case GEANY_FILETYPES_C: /* for C++ .h headers or C structs */
|
||||
case GEANY_FILETYPES_CPP:
|
||||
case GEANY_FILETYPES_GLSL: /* for structs */
|
||||
/*case GEANY_FILETYPES_RUBY:*/ /* not sure what to use atm*/
|
||||
case GEANY_FILETYPES_PHP:
|
||||
case GEANY_FILETYPES_POWERSHELL:
|
||||
case GEANY_FILETYPES_RUST:
|
||||
case GEANY_FILETYPES_ZEPHIR:
|
||||
return "::";
|
||||
|
||||
/* avoid confusion with other possible separators in group/section name */
|
||||
case GEANY_FILETYPES_CONF:
|
||||
case GEANY_FILETYPES_REST:
|
||||
return ":::";
|
||||
|
||||
/* no context separator */
|
||||
case GEANY_FILETYPES_ASCIIDOC:
|
||||
case GEANY_FILETYPES_TXT2TAGS:
|
||||
return "\x03";
|
||||
|
||||
default:
|
||||
return ".";
|
||||
}
|
||||
return tm_tag_context_separator(filetypes[ft_id]->lang);
|
||||
}
|
||||
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "read.h"
|
||||
#define LIBCTAGS_DEFINED
|
||||
#include "tm_tag.h"
|
||||
#include "tm_parser.h"
|
||||
|
||||
|
||||
#define TAG_NEW(T) ((T) = g_slice_new0(TMTag))
|
||||
@ -1167,6 +1168,35 @@ tm_get_current_tag (GPtrArray * file_tags, const gulong line, const TMTagType ta
|
||||
return matching_tag;
|
||||
}
|
||||
|
||||
const gchar *tm_tag_context_separator(langType lang)
|
||||
{
|
||||
switch (lang)
|
||||
{
|
||||
case TM_PARSER_C: /* for C++ .h headers or C structs */
|
||||
case TM_PARSER_CPP:
|
||||
case TM_PARSER_GLSL: /* for structs */
|
||||
/*case GEANY_FILETYPES_RUBY:*/ /* not sure what to use atm*/
|
||||
case TM_PARSER_PHP:
|
||||
case TM_PARSER_POWERSHELL:
|
||||
case TM_PARSER_RUST:
|
||||
case TM_PARSER_ZEPHIR:
|
||||
return "::";
|
||||
|
||||
/* avoid confusion with other possible separators in group/section name */
|
||||
case TM_PARSER_CONF:
|
||||
case TM_PARSER_REST:
|
||||
return ":::";
|
||||
|
||||
/* no context separator */
|
||||
case TM_PARSER_ASCIIDOC:
|
||||
case TM_PARSER_TXT2TAGS:
|
||||
return "\x03";
|
||||
|
||||
default:
|
||||
return ".";
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* Returns TMTag to function or method which "own" given line
|
||||
@param line Current line in edited file.
|
||||
|
@ -191,6 +191,8 @@ TMTag *tm_tag_ref(TMTag *tag);
|
||||
|
||||
gboolean tm_tags_equal(const TMTag *a, const TMTag *b);
|
||||
|
||||
const gchar *tm_tag_context_separator(langType lang);
|
||||
|
||||
#ifdef TM_DEBUG /* various debugging functions */
|
||||
|
||||
const char *tm_tag_type_name(const TMTag *tag);
|
||||
|
@ -857,10 +857,7 @@ find_scope_members (const GPtrArray *tags_array, GPtrArray *member_array,
|
||||
{
|
||||
gchar *tmp_name = type_name;
|
||||
|
||||
if (tag->file && tag->file->lang == TM_PARSER_JAVA)
|
||||
type_name = g_strdup_printf("%s.%s", tag->scope, type_name);
|
||||
else
|
||||
type_name = g_strdup_printf("%s::%s", tag->scope, type_name);
|
||||
type_name = g_strconcat(tag->scope, tm_tag_context_separator(lang), type_name, NULL);
|
||||
g_free(tmp_name);
|
||||
}
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user