anjuta r3830 - in trunk: . plugins/language-support-cpp-java



Author: jhs
Date: Mon Apr  7 20:36:00 2008
New Revision: 3830
URL: http://svn.gnome.org/viewvc/anjuta?rev=3830&view=rev

Log:
2008-04-07  Johannes Schmid  <jhs gnome org>

	* plugins/language-support-cpp-java/cpp-java-assist.c
	(completion_compare), (create_completion),
	(cpp_java_assist_create_word_completion_cache):
	
	Only show () for functions/methods and macros with arguments. Does not work
	with symbol-db yet but fixes things for symbol-browser

Modified:
   trunk/ChangeLog
   trunk/plugins/language-support-cpp-java/cpp-java-assist.c

Modified: trunk/plugins/language-support-cpp-java/cpp-java-assist.c
==============================================================================
--- trunk/plugins/language-support-cpp-java/cpp-java-assist.c	(original)
+++ trunk/plugins/language-support-cpp-java/cpp-java-assist.c	Mon Apr  7 20:36:00 2008
@@ -47,6 +47,7 @@
 {
 	gchar *name;
 	gboolean is_func;
+	IAnjutaSymbolType type;
 } CppJavaAssistTag;
 
 struct _CppJavaAssistPriv {
@@ -72,7 +73,8 @@
 {
 	CppJavaAssistTag * tag_a = (CppJavaAssistTag*) a;
 	CppJavaAssistTag * tag_b = (CppJavaAssistTag*) b;
-	return strcmp (tag_a->name, tag_b->name);
+	return (strcmp (tag_a->name, tag_b->name) &&
+			tag_a->type == tag_b->type);
 }
 
 static void
@@ -137,32 +139,29 @@
 create_completion (IAnjutaEditorAssist* iassist, IAnjutaIterable* iter)
 {
 	GCompletion *completion = g_completion_new (completion_function);
-	GHashTable *suggestions_hash = g_hash_table_new (g_str_hash, g_str_equal);
 	GList* suggestions = NULL;
 	do
 	{
 		const gchar* name = ianjuta_symbol_get_name (IANJUTA_SYMBOL(iter), NULL);
 		if (name != NULL)
 		{
-			if (!g_hash_table_lookup (suggestions_hash, name))
-			{
-				CppJavaAssistTag *tag = g_new0 (CppJavaAssistTag, 1);
-				tag->name = g_strdup (name);
-				tag->is_func = (ianjuta_symbol_get_args (IANJUTA_SYMBOL (iter),
-													 NULL)
-								!= NULL);
-				g_hash_table_insert (suggestions_hash, (gchar*)name,
-									 (gchar*)name);
+			CppJavaAssistTag *tag = g_new0 (CppJavaAssistTag, 1);
+			tag->name = g_strdup (name);
+			tag->type = ianjuta_symbol_get_sym_type (IANJUTA_SYMBOL (iter),
+													 NULL);
+			tag->is_func = (tag->type == IANJUTA_SYMBOL_TYPE_FUNCTION ||
+							tag->type == IANJUTA_SYMBOL_TYPE_METHOD ||
+							tag->type == IANJUTA_SYMBOL_TYPE_MACRO_WITH_ARG);
+			if (!g_list_find_custom (suggestions, tag, completion_compare))
 				suggestions = g_list_prepend (suggestions, tag);
-			}
+			else
+				g_free (tag);
 		}
 		else
 			break;
 	}
 	while (ianjuta_iterable_next (iter, NULL));
 	
-	g_hash_table_destroy (suggestions_hash);
-	
 	suggestions = g_list_sort (suggestions, completion_compare);
 	g_completion_add_items (completion, suggestions);
 	return completion;
@@ -341,7 +340,7 @@
 		ianjuta_symbol_manager_search (assist->priv->isymbol_manager,
 										IANJUTA_SYMBOL_TYPE_MAX,
 									    TRUE,
-										IANJUTA_SYMBOL_FIELD_SIMPLE,
+										IANJUTA_SYMBOL_FIELD_SIMPLE|IANJUTA_SYMBOL_FIELD_TYPE,
 										pre_word, TRUE, TRUE, NULL);
 	if (iter)
 	{



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]