[gnome-builder/wip/gtk4-port] libide/lsp: add load hooks for completion



commit 73d07dcf5159da9568032cf893d4080c62700548
Author: Christian Hergert <chergert redhat com>
Date:   Thu Apr 7 11:02:17 2022 -0700

    libide/lsp: add load hooks for completion
    
    We had this in our IdeCompletionProvider but won't anymore because we
    will rely on GtkSourceView's. This just helps with compat there.

 src/libide/lsp/ide-lsp-completion-provider.c | 14 ++++++++++++++
 src/libide/lsp/ide-lsp-completion-provider.h | 10 ++++------
 2 files changed, 18 insertions(+), 6 deletions(-)
---
diff --git a/src/libide/lsp/ide-lsp-completion-provider.c b/src/libide/lsp/ide-lsp-completion-provider.c
index 85ab06f70..5e276f987 100644
--- a/src/libide/lsp/ide-lsp-completion-provider.c
+++ b/src/libide/lsp/ide-lsp-completion-provider.c
@@ -38,6 +38,7 @@ typedef struct
   char          *word;
   char         **trigger_chars;
   char          *refilter_word;
+  guint          has_loaded : 1;
 } IdeLspCompletionProviderPrivate;
 
 static void provider_iface_init (GtkSourceCompletionProviderInterface *iface);
@@ -54,6 +55,11 @@ enum {
 
 static GParamSpec *properties [N_PROPS];
 
+static void
+ide_lsp_completion_provider_real_load (IdeLspCompletionProvider *self)
+{
+}
+
 static void
 ide_lsp_completion_provider_finalize (GObject *object)
 {
@@ -114,6 +120,8 @@ ide_lsp_completion_provider_class_init (IdeLspCompletionProviderClass *klass)
   object_class->get_property = ide_lsp_completion_provider_get_property;
   object_class->set_property = ide_lsp_completion_provider_set_property;
 
+  klass->load = ide_lsp_completion_provider_real_load;
+
   properties [PROP_CLIENT] =
     g_param_spec_object ("client",
                          "Client",
@@ -275,6 +283,12 @@ ide_lsp_completion_provider_populate_async (GtkSourceCompletionProvider *provide
   g_assert (IDE_IS_LSP_COMPLETION_PROVIDER (self));
   g_assert (GTK_SOURCE_IS_COMPLETION_CONTEXT (context));
 
+  if (!priv->has_loaded)
+    {
+      priv->has_loaded = TRUE;
+      IDE_LSP_COMPLETION_PROVIDER_GET_CLASS (self)->load (self);
+    }
+
   g_clear_pointer (&priv->refilter_word, g_free);
   g_clear_pointer (&priv->word, g_free);
 
diff --git a/src/libide/lsp/ide-lsp-completion-provider.h b/src/libide/lsp/ide-lsp-completion-provider.h
index 771aa4885..14583ce76 100644
--- a/src/libide/lsp/ide-lsp-completion-provider.h
+++ b/src/libide/lsp/ide-lsp-completion-provider.h
@@ -31,23 +31,21 @@
 G_BEGIN_DECLS
 
 #define IDE_TYPE_LSP_COMPLETION_PROVIDER (ide_lsp_completion_provider_get_type())
-
 #define IDE_LSP_COMPLETION_PROVIDER_PRIORITY 200
 
-IDE_AVAILABLE_IN_3_32
+IDE_AVAILABLE_IN_ALL
 G_DECLARE_DERIVABLE_TYPE (IdeLspCompletionProvider, ide_lsp_completion_provider, IDE, 
LSP_COMPLETION_PROVIDER, IdeObject)
 
 struct _IdeLspCompletionProviderClass
 {
   IdeObjectClass parent_class;
 
-  /*< private >*/
-  gpointer _reserved[8];
+  void (*load) (IdeLspCompletionProvider *self);
 };
 
-IDE_AVAILABLE_IN_3_32
+IDE_AVAILABLE_IN_ALL
 IdeLspClient *ide_lsp_completion_provider_get_client (IdeLspCompletionProvider *self);
-IDE_AVAILABLE_IN_3_32
+IDE_AVAILABLE_IN_ALL
 void          ide_lsp_completion_provider_set_client (IdeLspCompletionProvider *self,
                                                       IdeLspClient             *client);
 


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