Kaydet (Commit) f7b31cac authored tarafından Nick Treleaven's avatar Nick Treleaven

Use '::' context separator for C also (so C/C++ share the same

syntax, and C++ .h headers use correct syntax).
Add symbols_get_context_separator() and use for calltips and the
symbol list.


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@1174 ea778897-0a13-0410-b9d1-a72fbfd435f5
üst ccab52b6
2007-01-12 Nick Treleaven <nick.treleaven@btinternet.com>
* src/sci_cb.c, src/symbols.c, src/symbols.h:
Use '::' context separator for C also (so C/C++ share the same
syntax, and C++ .h headers use correct syntax).
Add symbols_get_context_separator() and use for calltips and the
symbol list.
2007-01-11 Nick Treleaven <nick.treleaven@btinternet.com>
* src/sci_cb.c:
......
......@@ -537,7 +537,7 @@ static gint find_start_bracket(ScintillaObject *sci, gint pos)
}
static gchar *tag_to_calltip(const TMTag *tag, gint ft_id)
static gchar *tag_to_calltip(const TMTag *tag, filetype_id ft_id)
{
GString *str;
gchar *result;
......@@ -559,11 +559,10 @@ static gchar *tag_to_calltip(const TMTag *tag, gint ft_id)
}
if (tag->atts.entry.scope)
{
const gchar *cosep = symbols_get_context_separator(ft_id);
g_string_append(str, tag->atts.entry.scope);
if (ft_id == GEANY_FILETYPES_D)
g_string_append_c(str, '.');
else
g_string_append(str, "::");
g_string_append(str, cosep);
}
g_string_append(str, tag->name);
g_string_append_c(str, ' ');
......
......@@ -150,6 +150,32 @@ GString *symbols_find_tags_as_string(GPtrArray *tags_array, guint tag_types)
}
const gchar *symbols_get_context_separator(filetype_id ft_id)
{
gchar *cosep;
switch (ft_id)
{
case GEANY_FILETYPES_C: // for C++ .h headers or C structs
case GEANY_FILETYPES_CPP:
{
static gchar cc[] = "::";
cosep = cc;
}
break;
default:
{
static gchar def[] = ".";
cosep = def;
}
}
return cosep; // return ptr to static string
}
const GList *symbols_get_tag_list(gint idx, guint tag_types)
{
static GList *tag_names = NULL;
......@@ -162,6 +188,8 @@ const GList *symbols_get_tag_list(gint idx, guint tag_types)
GeanySymbol *symbol;
gboolean doc_is_utf8 = FALSE;
gchar *utf8_name;
const gchar *cosep =
symbols_get_context_separator(FILETYPE_ID(doc_list[idx].file_type));
if (tag_names)
{
......@@ -191,9 +219,6 @@ const GList *symbols_get_tag_list(gint idx, guint tag_types)
else utf8_name = tag->name;
if ((tag->atts.entry.scope != NULL) && isalpha(tag->atts.entry.scope[0]))
{
// context separator
gchar *cosep = (doc_list[idx].file_type->id == GEANY_FILETYPES_CPP) ? "::" : ".";
symbol = g_new0(GeanySymbol, 1);
symbol->str = g_strdup_printf("%s%s%s [%ld]", tag->atts.entry.scope, cosep,
utf8_name, tag->atts.entry.line);
......
......@@ -25,6 +25,8 @@
#ifndef GEANY_SYMBOLS_H
#define GEANY_SYMBOLS_H 1
#include "filetypes.h"
extern const guint TM_GLOBAL_TYPE_MASK;
......@@ -32,6 +34,8 @@ void symbols_global_tags_loaded(gint file_type_idx);
GString *symbols_find_tags_as_string(GPtrArray *tags_array, guint tag_types);
const gchar *symbols_get_context_separator(filetype_id ft_id);
const GList *symbols_get_tag_list(gint idx, guint tag_types);
GString *symbols_get_macro_list();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment