[gnome-builder] code-index: remove legacy code index manager



commit c7efbc177371e8d65567af0a0bdea162feeca9df
Author: Christian Hergert <chergert redhat com>
Date:   Mon Feb 4 19:35:54 2019 -0800

    code-index: remove legacy code index manager
    
    We still have some bits to make the new one seamless, but this gets things
    removed so we can do that from clean slate.

 .../code-index/gbp-code-index-workbench-addin.c    |  589 +-------
 src/plugins/code-index/ide-code-index-builder.c    | 1448 --------------------
 src/plugins/code-index/ide-code-index-builder.h    |   47 -
 .../code-index/ide-code-index-symbol-resolver.c    |   13 +-
 src/plugins/code-index/meson.build                 |    1 -
 5 files changed, 10 insertions(+), 2088 deletions(-)
---
diff --git a/src/plugins/code-index/gbp-code-index-workbench-addin.c 
b/src/plugins/code-index/gbp-code-index-workbench-addin.c
index 346c7352a..70c7aba72 100644
--- a/src/plugins/code-index/gbp-code-index-workbench-addin.c
+++ b/src/plugins/code-index/gbp-code-index-workbench-addin.c
@@ -23,431 +23,21 @@
 #include "config.h"
 
 #include <dazzle.h>
-#include <gtksourceview/gtksource.h>
 #include <libide-foundry.h>
 #include <libide-gui.h>
 #include <libide-plugins.h>
-#include <libide-projects.h>
-#include <libide-vcs.h>
 
+#include "gbp-code-index-service.h"
 #include "gbp-code-index-workbench-addin.h"
-#include "ide-code-index-builder.h"
-
-#define DEFAULT_INDEX_TIMEOUT_SECS 5
-#define MAX_TRIALS 3
 
 struct _GbpCodeIndexWorkbenchAddin
 {
   IdeObject               parent_instance;
-
   IdeWorkbench           *workbench;
-
-  /* The builder to build & update index */
-  IdeCodeIndexBuilder    *builder;
-
-  /* The Index which will store all declarations */
+  GbpCodeIndexService    *service;
   IdeCodeIndexIndex      *index;
-
-  /* Queue of directories which needs to be indexed */
-  GQueue                  build_queue;
-  GHashTable             *build_dirs;
-
-  GHashTable             *code_indexers;
-
-  IdeNotification        *notif;
-  GCancellable           *cancellable;
-
-  guint                   paused : 1;
-  guint                   delayed_build_reqeusted : 1;
 };
 
-typedef struct
-{
-  volatile gint               ref_count;
-  GbpCodeIndexWorkbenchAddin *self;
-  GFile                      *directory;
-  guint                       n_trial;
-  guint                       recursive : 1;
-} BuildData;
-
-static void gbp_code_index_workbench_addin_build (GbpCodeIndexWorkbenchAddin *self,
-                                                  GFile                      *directory,
-                                                  gboolean                    recursive,
-                                                  guint                       n_trial);
-
-static void
-remove_source (gpointer source_id)
-{
-  if (source_id != NULL)
-    g_source_remove (GPOINTER_TO_UINT (source_id));
-}
-
-static void
-build_data_unref (BuildData *data)
-{
-  g_assert (data != NULL);
-  g_assert (data->ref_count > 0);
-
-  if (g_atomic_int_dec_and_test (&data->ref_count))
-    {
-      g_clear_object (&data->self);
-      g_clear_object (&data->directory);
-      g_slice_free (BuildData, data);
-    }
-}
-
-static BuildData *
-build_data_ref (BuildData *data)
-{
-  g_assert (data != NULL);
-  g_assert (data->ref_count > 0);
-  g_atomic_int_inc (&data->ref_count);
-  return data;
-}
-
-G_DEFINE_AUTOPTR_CLEANUP_FUNC (BuildData, build_data_unref)
-
-static void
-register_notification (GbpCodeIndexWorkbenchAddin *self)
-{
-  g_autoptr(IdeNotification) notif = NULL;
-  g_autoptr(GIcon) icon = NULL;
-  IdeContext *context;
-
-  g_assert (IDE_IS_MAIN_THREAD ());
-  g_assert (GBP_IS_CODE_INDEX_WORKBENCH_ADDIN (self));
-  g_assert (self->notif == NULL);
-
-  icon = g_icon_new_for_string ("media-playback-pause-symbolic", NULL);
-
-  notif = ide_notification_new ();
-  ide_notification_set_id (notif, "org.gnome.builder.code-index");
-  ide_notification_set_title (notif, "Indexing Source Code");
-  ide_notification_set_body (notif, "Search, diagnostics, and autocompletion may be limited until 
complete.");
-  ide_notification_set_has_progress (notif, TRUE);
-  ide_notification_set_progress (notif, 0);
-  ide_notification_set_progress_is_imprecise (notif, TRUE);
-  ide_notification_add_button (notif, NULL, icon, "code-index.paused");
-
-  context = ide_workbench_get_context (self->workbench);
-  ide_notification_attach (notif, IDE_OBJECT (context));
-
-  self->notif = g_object_ref (notif);
-}
-
-static void
-unregister_notification (GbpCodeIndexWorkbenchAddin *self)
-{
-  g_assert (IDE_IS_MAIN_THREAD ());
-  g_assert (GBP_IS_CODE_INDEX_WORKBENCH_ADDIN (self));
-
-  if (self->notif != NULL)
-    {
-      ide_notification_withdraw (self->notif);
-      g_clear_object (&self->notif);
-    }
-}
-
-static gboolean
-delay_until_build_completes (GbpCodeIndexWorkbenchAddin *self)
-{
-  IdePipeline *pipeline;
-  IdeBuildManager *build_manager;
-  IdeContext *context;
-
-  g_assert (IDE_IS_MAIN_THREAD ());
-  g_assert (GBP_IS_CODE_INDEX_WORKBENCH_ADDIN (self));
-
-  if (self->delayed_build_reqeusted)
-    return TRUE;
-
-  context = ide_object_get_context (IDE_OBJECT (self));
-  g_assert (IDE_IS_CONTEXT (context));
-
-  build_manager = ide_build_manager_from_context (context);
-  g_assert (IDE_IS_BUILD_MANAGER (build_manager));
-
-  pipeline = ide_build_manager_get_pipeline (build_manager);
-  g_assert (IDE_IS_PIPELINE (pipeline));
-
-  if (pipeline == NULL || !ide_pipeline_has_configured (pipeline))
-    {
-      self->delayed_build_reqeusted = TRUE;
-      return TRUE;
-    }
-
-  return FALSE;
-}
-
-static void
-gbp_code_index_workbench_addin_build_cb (GObject      *object,
-                                         GAsyncResult *result,
-                                         gpointer      user_data)
-{
-  g_autoptr(GbpCodeIndexWorkbenchAddin) self = user_data;
-  IdeCodeIndexBuilder *builder = (IdeCodeIndexBuilder *)object;
-  g_autoptr(BuildData) bdata = NULL;
-  g_autoptr(GError) error = NULL;
-
-  g_assert (IDE_IS_MAIN_THREAD ());
-  g_assert (GBP_IS_CODE_INDEX_WORKBENCH_ADDIN (self));
-  g_assert (G_IS_ASYNC_RESULT (result));
-  g_assert (IDE_IS_CODE_INDEX_BUILDER (builder));
-
-  if (ide_code_index_builder_build_finish (builder, result, &error))
-    g_debug ("Finished building code index");
-  else if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
-    g_warning ("Failed to build code index: %s", error->message);
-
-  if (ide_object_in_destruction (IDE_OBJECT (self)))
-    return;
-
-  bdata = g_queue_pop_head (&self->build_queue);
-
-  /*
-   * If we're paused, push this item back on the queue to
-   * be processed when we unpause.
-   */
-  if (self->paused)
-    {
-      g_queue_push_head (&self->build_queue, g_steal_pointer (&bdata));
-      return;
-    }
-
-  if (error != NULL &&
-      !g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
-    {
-      gbp_code_index_workbench_addin_build (self,
-                                            bdata->directory,
-                                            bdata->recursive,
-                                            bdata->n_trial + 1);
-    }
-
-  /* Index next directory */
-  if (!g_queue_is_empty (&self->build_queue))
-    {
-      BuildData *peek = g_queue_peek_head (&self->build_queue);
-
-      g_clear_object (&self->cancellable);
-      self->cancellable = g_cancellable_new ();
-
-      ide_code_index_builder_build_async (builder,
-                                          peek->directory,
-                                          peek->recursive,
-                                          self->cancellable,
-                                          gbp_code_index_workbench_addin_build_cb,
-                                          g_object_ref (self));
-    }
-  else
-    {
-      unregister_notification (self);
-    }
-}
-
-static gboolean
-ide_code_index_serivce_push (BuildData *bdata)
-{
-  g_assert (IDE_IS_MAIN_THREAD ());
-  g_assert (bdata != NULL);
-  g_assert (GBP_IS_CODE_INDEX_WORKBENCH_ADDIN (bdata->self));
-  g_assert (G_IS_FILE (bdata->directory));
-
-  if (g_queue_is_empty (&bdata->self->build_queue))
-    {
-      g_queue_push_tail (&bdata->self->build_queue, build_data_ref (bdata));
-
-      g_clear_object (&bdata->self->cancellable);
-      bdata->self->cancellable = g_cancellable_new ();
-
-      register_notification (bdata->self);
-
-      ide_code_index_builder_build_async (bdata->self->builder,
-                                          bdata->directory,
-                                          bdata->recursive,
-                                          bdata->self->cancellable,
-                                          gbp_code_index_workbench_addin_build_cb,
-                                          g_object_ref (bdata->self));
-    }
-  else
-    {
-      g_queue_push_tail (&bdata->self->build_queue, build_data_ref (bdata));
-    }
-
-  if (bdata->self->build_dirs != NULL)
-    g_hash_table_remove (bdata->self->build_dirs, bdata->directory);
-
-  return G_SOURCE_REMOVE;
-}
-
-static void
-gbp_code_index_workbench_addin_build (GbpCodeIndexWorkbenchAddin *self,
-                                      GFile                      *directory,
-                                      gboolean                    recursive,
-                                      guint                       n_trial)
-{
-  g_assert (IDE_IS_MAIN_THREAD ());
-  g_assert (GBP_IS_CODE_INDEX_WORKBENCH_ADDIN (self));
-  g_assert (G_IS_FILE (directory));
-
-  if (n_trial > MAX_TRIALS)
-    return;
-
-  /*
-   * If the build system is currently failed, then don't try to
-   * do any indexing now. We'll wait for a successful build that
-   * at least reaches IDE_PIPELINE_PHASE_CONFIGURE and then trigger
-   * after that.
-   */
-  if (delay_until_build_completes (self))
-    return;
-
-  if (!g_hash_table_lookup (self->build_dirs, directory))
-    {
-      g_autoptr(BuildData) bdata = NULL;
-      guint source_id;
-
-      bdata = g_slice_new0 (BuildData);
-      bdata->ref_count = 1;
-      bdata->self = g_object_ref (self);
-      bdata->directory = g_object_ref (directory);
-      bdata->recursive = recursive;
-      bdata->n_trial = n_trial;
-
-      source_id = g_timeout_add_seconds_full (G_PRIORITY_LOW,
-                                              DEFAULT_INDEX_TIMEOUT_SECS,
-                                              (GSourceFunc) ide_code_index_serivce_push,
-                                              g_steal_pointer (&bdata),
-                                              (GDestroyNotify) build_data_unref);
-
-      g_hash_table_insert (self->build_dirs,
-                           g_object_ref (directory),
-                           GUINT_TO_POINTER (source_id));
-    }
-}
-
-static void
-gbp_code_index_workbench_addin_vcs_changed (GbpCodeIndexWorkbenchAddin *self,
-                                            IdeVcs                     *vcs)
-{
-  GFile *workdir;
-
-  g_assert (IDE_IS_MAIN_THREAD ());
-  g_assert (GBP_IS_CODE_INDEX_WORKBENCH_ADDIN (self));
-  g_assert (IDE_IS_VCS (vcs));
-
-  workdir = ide_vcs_get_workdir (vcs);
-  gbp_code_index_workbench_addin_build (self, workdir, TRUE, 1);
-}
-
-static void
-gbp_code_index_workbench_addin_buffer_saved (GbpCodeIndexWorkbenchAddin *self,
-                                             IdeBuffer                  *buffer,
-                                             IdeBufferManager           *buffer_manager)
-{
-  g_autofree gchar *file_name = NULL;
-  GFile *file;
-
-  g_assert (IDE_IS_MAIN_THREAD ());
-  g_assert (GBP_IS_CODE_INDEX_WORKBENCH_ADDIN (self));
-  g_assert (IDE_IS_BUFFER (buffer));
-
-  file = ide_buffer_get_file (buffer);
-  file_name = g_file_get_uri (file);
-
-  if (!!gbp_code_index_workbench_addin_get_code_indexer (self, file_name))
-    {
-      g_autoptr(GFile) parent = NULL;
-
-      parent = g_file_get_parent (file);
-      gbp_code_index_workbench_addin_build (self, parent, FALSE, 1);
-    }
-}
-
-static void
-gbp_code_index_workbench_addin_file_trashed (GbpCodeIndexWorkbenchAddin *self,
-                                             GFile                      *file,
-                                             IdeProject                 *project)
-{
-  g_autofree gchar *file_name = NULL;
-
-  g_assert (IDE_IS_MAIN_THREAD ());
-  g_assert (GBP_IS_CODE_INDEX_WORKBENCH_ADDIN (self));
-  g_assert (G_IS_FILE (file));
-
-  file_name = g_file_get_uri (file);
-
-  if (!!gbp_code_index_workbench_addin_get_code_indexer (self, file_name))
-    {
-      g_autoptr(GFile) parent = NULL;
-
-      parent = g_file_get_parent (file);
-      gbp_code_index_workbench_addin_build (self, parent, FALSE, 1);
-    }
-}
-
-static void
-gbp_code_index_workbench_addin_file_renamed (GbpCodeIndexWorkbenchAddin *self,
-                                             GFile                      *src_file,
-                                             GFile                      *dst_file,
-                                             IdeProject                 *project)
-{
-  g_autofree gchar *src_file_name = NULL;
-  g_autofree gchar *dst_file_name = NULL;
-  g_autoptr(GFile) src_parent = NULL;
-  g_autoptr(GFile) dst_parent = NULL;
-
-  g_assert (IDE_IS_MAIN_THREAD ());
-  g_assert (GBP_IS_CODE_INDEX_WORKBENCH_ADDIN (self));
-  g_assert (G_IS_FILE (src_file));
-  g_assert (G_IS_FILE (dst_file));
-
-  src_file_name = g_file_get_uri (src_file);
-  dst_file_name = g_file_get_uri (dst_file);
-
-  src_parent = g_file_get_parent (src_file);
-  dst_parent = g_file_get_parent (dst_file);
-
-  if (g_file_equal (src_parent, dst_parent))
-    {
-      if (NULL != gbp_code_index_workbench_addin_get_code_indexer (self, src_file_name) ||
-          NULL != gbp_code_index_workbench_addin_get_code_indexer (self, dst_file_name))
-        gbp_code_index_workbench_addin_build (self, src_parent, FALSE, 1);
-    }
-  else
-    {
-      if (NULL != gbp_code_index_workbench_addin_get_code_indexer (self, src_file_name))
-        gbp_code_index_workbench_addin_build (self, src_parent, FALSE, 1);
-
-      if (NULL != gbp_code_index_workbench_addin_get_code_indexer (self, dst_file_name))
-        gbp_code_index_workbench_addin_build (self, dst_parent, FALSE, 1);
-    }
-}
-
-static void
-gbp_code_index_workbench_addin_build_finished (GbpCodeIndexWorkbenchAddin *self,
-                                               IdePipeline           *pipeline,
-                                               IdeBuildManager            *build_manager)
-{
-  g_assert (IDE_IS_MAIN_THREAD ());
-  g_assert (GBP_IS_CODE_INDEX_WORKBENCH_ADDIN (self));
-  g_assert (IDE_IS_PIPELINE (pipeline));
-  g_assert (IDE_IS_BUILD_MANAGER (build_manager));
-
-  if (self->delayed_build_reqeusted &&
-      ide_pipeline_has_configured (pipeline))
-    {
-      g_autoptr(GFile) workdir = NULL;
-      IdeContext *context;
-
-      self->delayed_build_reqeusted = FALSE;
-
-      context = ide_object_get_context (IDE_OBJECT (self));
-      workdir = ide_context_ref_workdir (context);
-
-      gbp_code_index_workbench_addin_build (self, workdir, TRUE, 1);
-    }
-}
-
 static void
 gbp_code_index_workbench_addin_load (IdeWorkbenchAddin *addin,
                                      IdeWorkbench      *workbench)
@@ -476,9 +66,6 @@ gbp_code_index_workbench_addin_unload (IdeWorkbenchAddin *addin,
   g_assert (GBP_IS_CODE_INDEX_WORKBENCH_ADDIN (self));
   g_assert (IDE_IS_WORKBENCH (workbench));
 
-  g_clear_pointer (&self->build_dirs, g_hash_table_unref);
-  g_clear_pointer (&self->code_indexers, g_hash_table_unref);
-  ide_clear_and_destroy_object (&self->builder);
   ide_clear_and_destroy_object (&self->index);
 
   context = ide_workbench_get_context (workbench);
@@ -492,66 +79,12 @@ gbp_code_index_workbench_addin_project_loaded (IdeWorkbenchAddin *addin,
                                                IdeProjectInfo    *project_info)
 {
   GbpCodeIndexWorkbenchAddin *self = (GbpCodeIndexWorkbenchAddin *)addin;
-  IdeBufferManager *bufmgr;
-  IdeBuildManager *buildmgr;
-  IdeContext *context;
-  IdeProject *project;
-  IdeVcs *vcs;
-  GFile *workdir;
 
   g_assert (IDE_IS_MAIN_THREAD ());
   g_assert (GBP_IS_CODE_INDEX_WORKBENCH_ADDIN (self));
   g_assert (IDE_IS_PROJECT_INFO (project_info));
 
-  context = ide_workbench_get_context (self->workbench);
-  project = ide_project_from_context (context);
-  bufmgr = ide_buffer_manager_from_context (context);
-  buildmgr = ide_build_manager_from_context (context);
-  vcs = ide_vcs_from_context (context);
-  workdir = ide_vcs_get_workdir (vcs);
-
-  self->code_indexers = g_hash_table_new_full (NULL,
-                                               NULL,
-                                               NULL,
-                                               (GDestroyNotify)ide_object_unref_and_destroy);
   self->index = ide_code_index_index_new (IDE_OBJECT (self));
-  self->builder = ide_code_index_builder_new (IDE_OBJECT (self), self->index);
-  self->build_dirs = g_hash_table_new_full (g_file_hash,
-                                            (GEqualFunc)g_file_equal,
-                                            g_object_unref,
-                                            remove_source);
-
-  g_signal_connect_object (vcs,
-                           "changed",
-                           G_CALLBACK (gbp_code_index_workbench_addin_vcs_changed),
-                           self,
-                           G_CONNECT_SWAPPED);
-
-  g_signal_connect_object (bufmgr,
-                           "buffer-saved",
-                           G_CALLBACK (gbp_code_index_workbench_addin_buffer_saved),
-                           self,
-                           G_CONNECT_SWAPPED);
-
-  g_signal_connect_object (buildmgr,
-                           "build-finished",
-                           G_CALLBACK (gbp_code_index_workbench_addin_build_finished),
-                           self,
-                           G_CONNECT_SWAPPED);
-
-  g_signal_connect_object (project,
-                           "file-trashed",
-                           G_CALLBACK (gbp_code_index_workbench_addin_file_trashed),
-                           self,
-                           G_CONNECT_SWAPPED);
-
-  g_signal_connect_object (project,
-                           "file-renamed",
-                           G_CALLBACK (gbp_code_index_workbench_addin_file_renamed),
-                           self,
-                           G_CONNECT_SWAPPED);
-
-  gbp_code_index_workbench_addin_build (self, workdir, TRUE, 1);
 }
 
 static void
@@ -602,10 +135,7 @@ gbp_code_index_workbench_addin_paused (GbpCodeIndexWorkbenchAddin *self,
   if (state == NULL || !g_variant_is_of_type (state, G_VARIANT_TYPE_BOOLEAN))
     return;
 
-  if (g_variant_get_boolean (state))
-    gbp_code_index_workbench_addin_pause (self);
-  else
-    gbp_code_index_workbench_addin_unpause (self);
+  gbp_code_index_service_set_paused (self->service, g_variant_get_boolean (state));
 }
 
 DZL_DEFINE_ACTION_GROUP (GbpCodeIndexWorkbenchAddin, gbp_code_index_workbench_addin, {
@@ -627,119 +157,6 @@ gbp_code_index_workbench_addin_init (GbpCodeIndexWorkbenchAddin *self)
 {
 }
 
-void
-gbp_code_index_workbench_addin_pause (GbpCodeIndexWorkbenchAddin *self)
-{
-  g_return_if_fail (IDE_IS_MAIN_THREAD ());
-  g_return_if_fail (GBP_IS_CODE_INDEX_WORKBENCH_ADDIN (self));
-
-  if (ide_object_in_destruction (IDE_OBJECT (self)))
-    return;
-
-  if (self->paused)
-    return;
-
-  self->paused = TRUE;
-
-  gbp_code_index_workbench_addin_set_action_state (self,
-                                                   "paused",
-                                                   g_variant_new_boolean (TRUE));
-
-  /*
-   * To pause things, we need to cancel our current task. The completion of the
-   * async task will check for cancelled and leave the build task for another
-   * pass.
-   */
-
-  g_cancellable_cancel (self->cancellable);
-}
-
-void
-gbp_code_index_workbench_addin_unpause (GbpCodeIndexWorkbenchAddin *self)
-{
-  BuildData *peek;
-
-  g_return_if_fail (IDE_IS_MAIN_THREAD ());
-  g_return_if_fail (GBP_IS_CODE_INDEX_WORKBENCH_ADDIN (self));
-
-  if (ide_object_in_destruction (IDE_OBJECT (self)))
-    return;
-
-  if (!self->paused)
-    return;
-
-  self->paused = FALSE;
-
-  gbp_code_index_workbench_addin_set_action_state (self,
-                                                   "paused",
-                                                   g_variant_new_boolean (FALSE));
-
-  peek = g_queue_peek_head (&self->build_queue);
-
-  if (peek != NULL)
-    {
-      GCancellable *cancellable;
-
-      g_clear_object (&self->cancellable);
-      self->cancellable = cancellable = g_cancellable_new ();
-
-      ide_code_index_builder_build_async (self->builder,
-                                          peek->directory,
-                                          peek->recursive,
-                                          cancellable,
-                                          gbp_code_index_workbench_addin_build_cb,
-                                          g_object_ref (self));
-    }
-}
-
-/**
- * gbp_code_index_workbench_addin_get_code_indexer:
- * @self: a #GbpCodeIndexWorkbenchAddin
- * @file_name: the name of the file to index
- *
- * Gets an #IdeCodeIndexer suitable for @file_name.
- *
- * Returns: (transfer none) (nullable): an #IdeCodeIndexer or %NULL
- */
-IdeCodeIndexer *
-gbp_code_index_workbench_addin_get_code_indexer (GbpCodeIndexWorkbenchAddin *self,
-                                                 const gchar                *file_name)
-{
-  GtkSourceLanguageManager *manager;
-  IdeExtensionAdapter *adapter;
-  GtkSourceLanguage *language;
-  const gchar *lang_id;
-
-  g_return_val_if_fail (IDE_IS_MAIN_THREAD (), NULL);
-  g_return_val_if_fail (GBP_IS_CODE_INDEX_WORKBENCH_ADDIN (self), NULL);
-  g_return_val_if_fail (file_name != NULL, NULL);
-
-  if (self->code_indexers == NULL ||
-      !(manager = gtk_source_language_manager_get_default ()) ||
-      !(language = gtk_source_language_manager_guess_language (manager, file_name, NULL)) ||
-      !(lang_id = gtk_source_language_get_id (language)))
-    return NULL;
-
-  lang_id = g_intern_string (lang_id);
-  adapter = g_hash_table_lookup (self->code_indexers, lang_id);
-
-  g_assert (!adapter || IDE_IS_EXTENSION_ADAPTER (adapter));
-
-  if (adapter == NULL)
-    {
-      adapter = ide_extension_adapter_new (IDE_OBJECT (self),
-                                           peas_engine_get_default (),
-                                           IDE_TYPE_CODE_INDEXER,
-                                           "Code-Indexer-Languages",
-                                           lang_id);
-      g_hash_table_insert (self->code_indexers, (gchar *)lang_id, adapter);
-    }
-
-  g_assert (IDE_IS_EXTENSION_ADAPTER (adapter));
-
-  return ide_extension_adapter_get_extension (adapter);
-}
-
 GbpCodeIndexWorkbenchAddin *
 gbp_code_index_workbench_addin_from_context (IdeContext *context)
 {
diff --git a/src/plugins/code-index/ide-code-index-symbol-resolver.c 
b/src/plugins/code-index/ide-code-index-symbol-resolver.c
index 74f018db8..93cc75230 100644
--- a/src/plugins/code-index/ide-code-index-symbol-resolver.c
+++ b/src/plugins/code-index/ide-code-index-symbol-resolver.c
@@ -20,6 +20,7 @@
 
 #define G_LOG_DOMAIN "code-index-symbol-resolver"
 
+#include "gbp-code-index-service.h"
 #include "gbp-code-index-workbench-addin.h"
 #include "ide-code-index-symbol-resolver.h"
 
@@ -132,15 +133,15 @@ ide_code_index_symbol_resolver_lookup_flags_cb (GObject      *object,
 
 static void
 ide_code_index_symbol_resolver_lookup_symbol_async (IdeSymbolResolver   *resolver,
-                                                    IdeLocation   *location,
+                                                    IdeLocation         *location,
                                                     GCancellable        *cancellable,
                                                     GAsyncReadyCallback  callback,
                                                     gpointer             user_data)
 {
   IdeCodeIndexSymbolResolver *self = (IdeCodeIndexSymbolResolver *)resolver;
-  GbpCodeIndexWorkbenchAddin *addin;
+  GbpCodeIndexService *service;
   g_autoptr(IdeTask) task = NULL;
-  IdeCodeIndexer *code_indexer;
+  g_autoptr(IdeCodeIndexer) code_indexer = NULL;
   IdeBuildSystem *build_system;
   const gchar *path;
   IdeContext *context;
@@ -162,14 +163,14 @@ ide_code_index_symbol_resolver_lookup_symbol_async (IdeSymbolResolver   *resolve
   context = ide_object_get_context (IDE_OBJECT (self));
   g_assert (IDE_IS_CONTEXT (context));
 
-  addin = gbp_code_index_workbench_addin_from_context (context);
-  g_assert (GBP_IS_CODE_INDEX_WORKBENCH_ADDIN (addin));
+  service = gbp_code_index_service_from_context (context);
+  g_assert (GBP_IS_CODE_INDEX_SERVICE (service));
 
   file = ide_location_get_file (location);
   path = g_file_peek_path (file);
   g_assert (path != NULL);
 
-  code_indexer = gbp_code_index_workbench_addin_get_code_indexer (addin, path);
+  code_indexer = gbp_code_index_service_get_indexer (service, NULL, path);
   g_assert (!code_indexer || IDE_IS_CODE_INDEXER (code_indexer));
 
   if (code_indexer == NULL)
diff --git a/src/plugins/code-index/meson.build b/src/plugins/code-index/meson.build
index 1917c28af..c6f175d81 100644
--- a/src/plugins/code-index/meson.build
+++ b/src/plugins/code-index/meson.build
@@ -8,7 +8,6 @@ plugins_sources += files([
   'gbp-code-index-plan.c',
   'gbp-code-index-service.c',
   'gbp-code-index-workbench-addin.c',
-  'ide-code-index-builder.c',
   'ide-code-index-index.c',
   'ide-code-index-search-provider.c',
   'ide-code-index-search-result.c',


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