[gnome-builder/wip/chergert/lsp-plugin-loader] libide/lsp: start on custom plugin loader for LSPs




commit f5aac0c5fe84bdb258bf1ae9745729f7ca271fd6
Author: Christian Hergert <chergert redhat com>
Date:   Thu Oct 6 18:01:47 2022 -0700

    libide/lsp: start on custom plugin loader for LSPs
    
    This requires a hacked up libpeas currently, so I'm afraid you can't
    expect things to build.
    
    But what will be required is to actually ship PeasPluginLoader headers
    (currently they are in the ABI but not shipped) and also some small
    tweaks here and there to make mappings work correctly.

 src/libide/lsp/ide-lsp-plugin-loader.c | 110 +++++++++++++++++++++++++++++++++
 src/libide/lsp/ide-lsp-plugin-loader.h |  32 ++++++++++
 src/libide/lsp/meson.build             |   2 +
 3 files changed, 144 insertions(+)
---
diff --git a/src/libide/lsp/ide-lsp-plugin-loader.c b/src/libide/lsp/ide-lsp-plugin-loader.c
new file mode 100644
index 000000000..32e708aa9
--- /dev/null
+++ b/src/libide/lsp/ide-lsp-plugin-loader.c
@@ -0,0 +1,110 @@
+/* ide-lsp-plugin-loader.c
+ *
+ * Copyright 2022 Christian Hergert <chergert redhat com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+#define G_LOG_DOMAIN "ide-lsp-plugin-loader"
+
+#include "config.h"
+
+#include "ide-lsp-plugin-loader.h"
+
+struct _IdeLspPluginLoader
+{
+  PeasPluginLoader parent_instance;
+};
+
+G_DEFINE_FINAL_TYPE (IdeLspPluginLoader, ide_lsp_plugin_loader, PEAS_TYPE_PLUGIN_LOADER)
+
+static gboolean
+ide_lsp_plugin_loader_initialize (PeasPluginLoader *loader)
+{
+  return TRUE;
+}
+
+static gboolean
+ide_lsp_plugin_loader_is_global (PeasPluginLoader *loader)
+{
+  return FALSE;
+}
+
+static gboolean
+ide_lsp_plugin_loader_load (PeasPluginLoader *loader,
+                            PeasPluginInfo   *plugin_info)
+{
+  return FALSE;
+}
+
+static void
+ide_lsp_plugin_loader_unload (PeasPluginLoader *loader,
+                              PeasPluginInfo   *plugin_info)
+{
+}
+
+static gboolean
+ide_lsp_plugin_loader_provides_extension (PeasPluginLoader *loader,
+                                          PeasPluginInfo   *plugin_info,
+                                          GType             ext_type)
+{
+  return FALSE;
+}
+
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+static PeasExtension *
+ide_lsp_plugin_loader_create_extension (PeasPluginLoader *loader,
+                                        PeasPluginInfo   *plugin_info,
+                                        GType             ext_type,
+                                        guint             n_parameters,
+                                        GParameter       *parameters)
+{
+  return NULL;
+}
+G_GNUC_END_IGNORE_DEPRECATIONS
+
+static void
+ide_lsp_plugin_loader_garbage_collect (PeasPluginLoader *loader)
+{
+}
+
+static void
+ide_lsp_plugin_loader_dispose (GObject *object)
+{
+  G_OBJECT_CLASS (ide_lsp_plugin_loader_parent_class)->dispose (object);
+}
+
+static void
+ide_lsp_plugin_loader_class_init (IdeLspPluginLoaderClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  PeasPluginLoaderClass *loader_class = PEAS_PLUGIN_LOADER_CLASS (klass);
+
+  object_class->dispose = ide_lsp_plugin_loader_dispose;
+
+  loader_class->initialize = ide_lsp_plugin_loader_initialize;
+  loader_class->is_global = ide_lsp_plugin_loader_is_global;
+  loader_class->load = ide_lsp_plugin_loader_load;
+  loader_class->unload = ide_lsp_plugin_loader_unload;
+  loader_class->provides_extension = ide_lsp_plugin_loader_provides_extension;
+  loader_class->create_extension = ide_lsp_plugin_loader_create_extension;
+  loader_class->garbage_collect = ide_lsp_plugin_loader_garbage_collect;
+}
+
+static void
+ide_lsp_plugin_loader_init (IdeLspPluginLoader *self)
+{
+}
diff --git a/src/libide/lsp/ide-lsp-plugin-loader.h b/src/libide/lsp/ide-lsp-plugin-loader.h
new file mode 100644
index 000000000..5151ff299
--- /dev/null
+++ b/src/libide/lsp/ide-lsp-plugin-loader.h
@@ -0,0 +1,32 @@
+/* ide-lsp-plugin-loader.h
+ *
+ * Copyright 2022 Christian Hergert <chergert redhat com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+#pragma once
+
+#include <libpeas/peas.h>
+#include <libpeas/peas-plugin-loader.h>
+
+G_BEGIN_DECLS
+
+#define IDE_TYPE_LSP_PLUGIN_LOADER (ide_lsp_plugin_loader_get_type())
+
+G_DECLARE_FINAL_TYPE (IdeLspPluginLoader, ide_lsp_plugin_loader, IDE, LSP_PLUGIN_LOADER, PeasPluginLoader)
+
+G_END_DECLS
diff --git a/src/libide/lsp/meson.build b/src/libide/lsp/meson.build
index f623287d5..f54ad5530 100644
--- a/src/libide/lsp/meson.build
+++ b/src/libide/lsp/meson.build
@@ -31,6 +31,7 @@ libide_lsp_public_headers = [
 ]
 
 libide_lsp_private_headers = [
+  'ide-lsp-plugin-loader.h',
   'ide-lsp-symbol-node-private.h',
   'ide-lsp-symbol-tree-private.h',
 ]
@@ -65,6 +66,7 @@ libide_lsp_public_sources = [
 ]
 
 libide_lsp_private_sources = [
+  'ide-lsp-plugin-loader.c',
 ]
 
 libide_lsp_enum_headers = [


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