[gnome-builder] plugins/clang: add more tracing information for completion
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] plugins/clang: add more tracing information for completion
- Date: Fri, 30 Sep 2022 04:34:27 +0000 (UTC)
commit 5f447e89760f797d5dc6092b4eae5db577950596
Author: Christian Hergert <chergert redhat com>
Date: Thu Sep 29 21:34:21 2022 -0700
plugins/clang: add more tracing information for completion
src/plugins/clang/ide-clang-completion-provider.c | 41 +++++++++++++++---
src/plugins/clang/ide-clang-proposals.c | 53 ++++++++++++++++++++---
2 files changed, 83 insertions(+), 11 deletions(-)
---
diff --git a/src/plugins/clang/ide-clang-completion-provider.c
b/src/plugins/clang/ide-clang-completion-provider.c
index d4e3c4d4b..8ac3428e6 100644
--- a/src/plugins/clang/ide-clang-completion-provider.c
+++ b/src/plugins/clang/ide-clang-completion-provider.c
@@ -306,6 +306,8 @@ ide_clang_completion_provider_refilter (GtkSourceCompletionProvider *provider,
{
IdeClangCompletionProvider *self = (IdeClangCompletionProvider *)provider;
+ IDE_ENTRY;
+
g_assert (IDE_IS_CLANG_COMPLETION_PROVIDER (self));
g_assert (GTK_SOURCE_IS_COMPLETION_CONTEXT (context));
g_assert (G_IS_LIST_MODEL (proposals));
@@ -319,7 +321,11 @@ ide_clang_completion_provider_refilter (GtkSourceCompletionProvider *provider,
gtk_source_completion_context_get_bounds (context, &begin, &end);
self->refilter_word = gtk_text_iter_get_slice (&begin, &end);
ide_clang_proposals_refilter (self->proposals, self->refilter_word);
+
+ IDE_EXIT;
}
+
+ IDE_EXIT;
}
static gchar *
@@ -334,6 +340,8 @@ ide_clang_completion_provider_load (IdeClangCompletionProvider *self)
g_autoptr(IdeClangClient) client = NULL;
g_autoptr(IdeContext) context = NULL;
+ IDE_ENTRY;
+
g_assert (IDE_IS_CLANG_COMPLETION_PROVIDER (self));
g_assert (self->loaded == FALSE);
@@ -343,6 +351,8 @@ ide_clang_completion_provider_load (IdeClangCompletionProvider *self)
client = ide_object_ensure_child_typed (IDE_OBJECT (context), IDE_TYPE_CLANG_CLIENT);
g_set_object (&self->client, client);
+
+ IDE_EXIT;
}
static void
@@ -354,14 +364,22 @@ ide_clang_completion_provider_populate_cb (GObject *object,
g_autoptr(IdeTask) task = user_data;
g_autoptr(GError) error = NULL;
+ IDE_ENTRY;
+
g_assert (IDE_IS_CLANG_PROPOSALS (proposals));
g_assert (G_IS_ASYNC_RESULT (result));
g_assert (IDE_IS_TASK (task));
if (!ide_clang_proposals_populate_finish (proposals, result, &error))
- ide_task_return_error (task, g_steal_pointer (&error));
- else
- ide_task_return_pointer (task, g_object_ref (proposals), g_object_unref);
+ {
+ IDE_TRACE_MSG ("Clang completion failed: %s", error->message);
+ ide_task_return_error (task, g_steal_pointer (&error));
+ IDE_EXIT;
+ }
+
+ ide_task_return_pointer (task, g_object_ref (proposals), g_object_unref);
+
+ IDE_EXIT;
}
static void
@@ -375,6 +393,8 @@ ide_clang_completion_provider_populate_async (GtkSourceCompletionProvider *prov
g_autoptr(IdeTask) task = NULL;
GtkTextIter begin, end;
+ IDE_ENTRY;
+
g_assert (IDE_IS_CLANG_COMPLETION_PROVIDER (self));
g_assert (!cancellable || G_IS_CANCELLABLE (cancellable));
@@ -408,17 +428,26 @@ ide_clang_completion_provider_populate_async (GtkSourceCompletionProvider *prov
cancellable,
ide_clang_completion_provider_populate_cb,
g_steal_pointer (&task));
+
+ IDE_EXIT;
}
static GListModel *
ide_clang_completion_provider_populate_finish (GtkSourceCompletionProvider *provider,
- GAsyncResult *result,
- GError **error)
+ GAsyncResult *result,
+ GError **error)
{
+ GListModel *ret;
+
+ IDE_ENTRY;
+
+ g_assert (IDE_IS_MAIN_THREAD ());
g_assert (IDE_IS_CLANG_COMPLETION_PROVIDER (provider));
g_assert (IDE_IS_TASK (result));
- return ide_task_propagate_pointer (IDE_TASK (result), error);
+ ret = ide_task_propagate_pointer (IDE_TASK (result), error);
+
+ IDE_RETURN (ret);
}
static void
diff --git a/src/plugins/clang/ide-clang-proposals.c b/src/plugins/clang/ide-clang-proposals.c
index 3af1caf3c..521d5099c 100644
--- a/src/plugins/clang/ide-clang-proposals.c
+++ b/src/plugins/clang/ide-clang-proposals.c
@@ -249,6 +249,8 @@ ide_clang_proposals_clear (IdeClangProposals *self)
GList *list;
guint old_len;
+ IDE_ENTRY;
+
g_assert (IDE_IS_CLANG_PROPOSALS (self));
self->line = -1;
@@ -276,6 +278,8 @@ ide_clang_proposals_clear (IdeClangProposals *self)
}
g_list_free (list);
+
+ IDE_EXIT;
}
IdeClangProposals *
@@ -320,6 +324,8 @@ ide_clang_proposals_do_refilter (IdeClangProposals *self,
guint old_len = 0;
guint n_items;
+ IDE_ENTRY;
+
g_assert (IDE_IS_CLANG_PROPOSALS (self));
old_len = self->match_indexes->len;
@@ -344,7 +350,7 @@ ide_clang_proposals_do_refilter (IdeClangProposals *self,
g_list_model_items_changed (G_LIST_MODEL (self), 0, old_len, self->match_indexes->len);
- return;
+ IDE_EXIT;
}
if (old_len > 0)
@@ -355,6 +361,8 @@ ide_clang_proposals_do_refilter (IdeClangProposals *self,
else
n_items = 0;
+ IDE_TRACE_MSG ("Filtering with filter: '%s'", self->filter ? self->filter : "");
+
if (self->filter == NULL || self->filter[0] == 0)
{
g_array_set_size (self->match_indexes, n_items);
@@ -399,7 +407,11 @@ ide_clang_proposals_do_refilter (IdeClangProposals *self,
g_array_sort (self->match_indexes, sort_by_priority);
}
+ IDE_TRACE_MSG ("Filtered %u into %u proposals", n_items, self->match_indexes->len);
+
g_list_model_items_changed (G_LIST_MODEL (self), 0, old_len, self->match_indexes->len);
+
+ IDE_EXIT;
}
static void
@@ -409,9 +421,14 @@ ide_clang_proposals_flush (IdeClangProposals *self,
{
GList *list;
+ IDE_ENTRY;
+
g_assert (IDE_IS_CLANG_PROPOSALS (self));
g_assert (results != NULL || error != NULL);
+ if (error != NULL)
+ g_debug ("Completion query failed: %s", error->message);
+
if (results != NULL)
g_variant_ref_sink (results);
g_clear_pointer (&self->results, g_variant_unref);
@@ -443,6 +460,8 @@ ide_clang_proposals_flush (IdeClangProposals *self,
}
g_list_free (list);
+
+ IDE_EXIT;
}
static void
@@ -455,6 +474,8 @@ ide_clang_proposals_query_complete_cb (GObject *object,
g_autoptr(IdeTask) task = user_data;
g_autoptr(GError) error = NULL;
+ IDE_ENTRY;
+
g_assert (IDE_IS_CLANG_CLIENT (client));
g_assert (G_IS_ASYNC_RESULT (result));
g_assert (IDE_IS_TASK (task));
@@ -467,6 +488,8 @@ ide_clang_proposals_query_complete_cb (GObject *object,
ide_task_return_pointer (task,
g_steal_pointer (&variant),
g_variant_unref);
+
+ IDE_EXIT;
}
static void
@@ -481,6 +504,8 @@ ide_clang_proposals_query_build_flags_cb (GObject *object,
GCancellable *cancellable;
Query *query;
+ IDE_ENTRY;
+
g_assert (IDE_IS_BUILD_SYSTEM (build_system));
g_assert (G_IS_ASYNC_RESULT (result));
g_assert (IDE_IS_TASK (task));
@@ -488,7 +513,7 @@ ide_clang_proposals_query_build_flags_cb (GObject *object,
flags = ide_build_system_get_build_flags_finish (build_system, result, &error);
if (ide_task_return_error_if_cancelled (task))
- return;
+ IDE_EXIT;
query = ide_task_get_task_data (task);
cancellable = ide_task_get_cancellable (task);
@@ -506,6 +531,8 @@ ide_clang_proposals_query_build_flags_cb (GObject *object,
cancellable,
ide_clang_proposals_query_complete_cb,
g_steal_pointer (&task));
+
+ IDE_EXIT;
}
static void
@@ -522,6 +549,8 @@ ide_clang_proposals_query_async (IdeClangProposals *self,
IdeContext *context;
Query *q;
+ IDE_ENTRY;
+
g_assert (IDE_IS_CLANG_PROPOSALS (self));
g_assert (G_IS_FILE (file));
g_assert (!cancellable || G_IS_CANCELLABLE (cancellable));
@@ -545,6 +574,8 @@ ide_clang_proposals_query_async (IdeClangProposals *self,
cancellable,
ide_clang_proposals_query_build_flags_cb,
g_steal_pointer (&task));
+
+ IDE_EXIT;
}
static GVariant *
@@ -554,6 +585,8 @@ ide_clang_proposals_query_finish (IdeClangProposals *self,
{
g_autoptr(GVariant) ret = NULL;
+ IDE_ENTRY;
+
g_return_val_if_fail (IDE_IS_CLANG_PROPOSALS (self), NULL);
g_return_val_if_fail (IDE_IS_TASK (result), NULL);
@@ -567,11 +600,11 @@ ide_clang_proposals_query_finish (IdeClangProposals *self,
G_IO_ERROR,
G_IO_ERROR_CANCELLED,
"Query is no longer valid");
- return NULL;
+ IDE_RETURN (NULL);
}
}
- return g_steal_pointer (&ret);
+ IDE_RETURN (g_steal_pointer (&ret));
}
static void
@@ -720,10 +753,16 @@ ide_clang_proposals_populate_finish (IdeClangProposals *self,
GAsyncResult *result,
GError **error)
{
+ gboolean ret;
+
+ IDE_ENTRY;
+
g_return_val_if_fail (IDE_IS_CLANG_PROPOSALS (self), FALSE);
g_return_val_if_fail (G_IS_ASYNC_RESULT (result), FALSE);
- return ide_task_propagate_boolean (IDE_TASK (result), error);
+ ret = ide_task_propagate_boolean (IDE_TASK (result), error);
+
+ IDE_RETURN (ret);
}
void
@@ -732,11 +771,15 @@ ide_clang_proposals_refilter (IdeClangProposals *self,
{
gboolean fast_refilter;
+ IDE_ENTRY;
+
g_assert (IDE_IS_CLANG_PROPOSALS (self));
fast_refilter = self->filter && word && g_str_has_prefix (word, self->filter);
ide_set_string (&self->filter, word);
ide_clang_proposals_do_refilter (self, fast_refilter);
+
+ IDE_EXIT;
}
static guint
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]