[gnome-builder] plugins/serve-d: add serve-d plugin for D



commit 0dc70a06b7875be53eae8b26865b1faa50c832f3
Author: Christian Hergert <chergert redhat com>
Date:   Thu Oct 6 16:48:30 2022 -0700

    plugins/serve-d: add serve-d plugin for D
    
    This isn't really that functional yet, because there seem to be a number
    of quirks in the serve-d process that are just not playing well with our
    LSP client implementation.
    
    We'll likely need to iterate on it if we want to make this generally
    useful for D programming.

 meson_options.txt                                  |  1 +
 src/plugins/meson.build                            |  2 +
 .../serve-d/gbp-served-code-action-provider.c      | 65 +++++++++++++++++++++
 .../serve-d/gbp-served-code-action-provider.h      | 31 ++++++++++
 .../serve-d/gbp-served-completion-provider.c       | 61 +++++++++++++++++++
 .../serve-d/gbp-served-completion-provider.h       | 31 ++++++++++
 .../serve-d/gbp-served-diagnostic-provider.c       | 65 +++++++++++++++++++++
 .../serve-d/gbp-served-diagnostic-provider.h       | 31 ++++++++++
 src/plugins/serve-d/gbp-served-formatter.c         | 65 +++++++++++++++++++++
 src/plugins/serve-d/gbp-served-formatter.h         | 31 ++++++++++
 src/plugins/serve-d/gbp-served-highlighter.c       | 65 +++++++++++++++++++++
 src/plugins/serve-d/gbp-served-highlighter.h       | 31 ++++++++++
 src/plugins/serve-d/gbp-served-hover-provider.c    | 66 +++++++++++++++++++++
 src/plugins/serve-d/gbp-served-hover-provider.h    | 31 ++++++++++
 src/plugins/serve-d/gbp-served-rename-provider.c   | 65 +++++++++++++++++++++
 src/plugins/serve-d/gbp-served-rename-provider.h   | 31 ++++++++++
 src/plugins/serve-d/gbp-served-service.c           | 62 ++++++++++++++++++++
 src/plugins/serve-d/gbp-served-service.h           | 31 ++++++++++
 src/plugins/serve-d/gbp-served-symbol-resolver.c   | 65 +++++++++++++++++++++
 src/plugins/serve-d/gbp-served-symbol-resolver.h   | 31 ++++++++++
 src/plugins/serve-d/meson.build                    | 24 ++++++++
 src/plugins/serve-d/serve-d-plugin.c               | 68 ++++++++++++++++++++++
 src/plugins/serve-d/serve-d.gresource.xml          |  6 ++
 src/plugins/serve-d/serve-d.plugin                 | 16 +++++
 24 files changed, 975 insertions(+)
---
diff --git a/meson_options.txt b/meson_options.txt
index 17955b70e..ad2444b6f 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -73,6 +73,7 @@ option('plugin_retab', type: 'boolean')
 option('plugin_rstcheck', type: 'boolean')
 option('plugin_rubocop', type: 'boolean')
 option('plugin_rust_analyzer', type: 'boolean')
+option('plugin_serve_d', type: 'boolean')
 option('plugin_shellcmd', type: 'boolean')
 option('plugin_shellcheck', type: 'boolean')
 option('plugin_spellcheck', type: 'boolean')
diff --git a/src/plugins/meson.build b/src/plugins/meson.build
index 0b054741b..ef0ae4fe6 100644
--- a/src/plugins/meson.build
+++ b/src/plugins/meson.build
@@ -117,6 +117,7 @@ subdir('rstcheck')
 subdir('rubocop')
 subdir('rust-analyzer')
 subdir('sdkui')
+subdir('serve-d')
 subdir('sessionui')
 subdir('shellcheck')
 subdir('shellcmd')
@@ -227,6 +228,7 @@ status += [
   'jedi-language-server ........ (Python) : @0@ **'.format(get_option('plugin_jedi_language_server')),
   'lua-language-server ............ (Lua) : @0@'.format(get_option('plugin_lua_language_server')),
   'python-lsp-server ........... (Python) : @0@'.format(get_option('plugin_python_lsp_server')),
+  'serve-d .......................... (D) : @0@'.format(get_option('plugin_serve_d')),
   'rust-analyzer ................. (Rust) : @0@'.format(get_option('plugin_rust_analyzer')),
   'ts-language-server ... (JS/TypeScript) : @0@'.format(get_option('plugin_ts_language_server')),
   'vala-language-server .......... (Vala) : @0@'.format(get_option('plugin_vls')),
diff --git a/src/plugins/serve-d/gbp-served-code-action-provider.c 
b/src/plugins/serve-d/gbp-served-code-action-provider.c
new file mode 100644
index 000000000..098898774
--- /dev/null
+++ b/src/plugins/serve-d/gbp-served-code-action-provider.c
@@ -0,0 +1,65 @@
+/* gbp-served-code-action-provider.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 "gbp-served-code-action-provider"
+
+#include "config.h"
+
+#include "gbp-served-code-action-provider.h"
+#include "gbp-served-service.h"
+
+struct _GbpServedCodeActionProvider
+{
+  IdeLspCodeActionProvider parent_instance;
+};
+
+static void
+gbp_served_code_action_provider_load (IdeCodeActionProvider *provider)
+{
+  g_autoptr(IdeLspServiceClass) klass = NULL;
+
+  IDE_ENTRY;
+
+  g_assert (GBP_IS_SERVED_CODE_ACTION_PROVIDER (provider));
+
+  klass = g_type_class_ref (GBP_TYPE_SERVED_SERVICE);
+  ide_lsp_service_class_bind_client (klass, IDE_OBJECT (provider));
+
+  IDE_EXIT;
+}
+
+static void
+code_action_provider_iface_init (IdeCodeActionProviderInterface *iface)
+{
+  iface->load = gbp_served_code_action_provider_load;
+}
+
+G_DEFINE_FINAL_TYPE_WITH_CODE (GbpServedCodeActionProvider, gbp_served_code_action_provider, 
IDE_TYPE_LSP_CODE_ACTION_PROVIDER,
+                               G_IMPLEMENT_INTERFACE (IDE_TYPE_CODE_ACTION_PROVIDER, 
code_action_provider_iface_init))
+
+static void
+gbp_served_code_action_provider_class_init (GbpServedCodeActionProviderClass *klass)
+{
+}
+
+static void
+gbp_served_code_action_provider_init (GbpServedCodeActionProvider *self)
+{
+}
diff --git a/src/plugins/serve-d/gbp-served-code-action-provider.h 
b/src/plugins/serve-d/gbp-served-code-action-provider.h
new file mode 100644
index 000000000..69801afc1
--- /dev/null
+++ b/src/plugins/serve-d/gbp-served-code-action-provider.h
@@ -0,0 +1,31 @@
+/* gbp-served-code-action-provider.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 <libide-lsp.h>
+
+G_BEGIN_DECLS
+
+#define GBP_TYPE_SERVED_CODE_ACTION_PROVIDER (gbp_served_code_action_provider_get_type())
+
+G_DECLARE_FINAL_TYPE (GbpServedCodeActionProvider, gbp_served_code_action_provider, GBP, 
SERVED_CODE_ACTION_PROVIDER, IdeLspCodeActionProvider)
+
+G_END_DECLS
diff --git a/src/plugins/serve-d/gbp-served-completion-provider.c 
b/src/plugins/serve-d/gbp-served-completion-provider.c
new file mode 100644
index 000000000..6c04239c9
--- /dev/null
+++ b/src/plugins/serve-d/gbp-served-completion-provider.c
@@ -0,0 +1,61 @@
+/* gbp-served-completion-provider.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 "gbp-served-completion-provider"
+
+#include "config.h"
+
+#include "gbp-served-completion-provider.h"
+#include "gbp-served-service.h"
+
+struct _GbpServedCompletionProvider
+{
+  IdeLspCompletionProvider parent_instance;
+};
+
+static void
+gbp_served_completion_provider_load (IdeLspCompletionProvider *provider)
+{
+  g_autoptr(IdeLspServiceClass) klass = NULL;
+
+  IDE_ENTRY;
+
+  g_assert (GBP_IS_SERVED_COMPLETION_PROVIDER (provider));
+
+  klass = g_type_class_ref (GBP_TYPE_SERVED_SERVICE);
+  ide_lsp_service_class_bind_client (klass, IDE_OBJECT (provider));
+
+  IDE_EXIT;
+}
+
+G_DEFINE_FINAL_TYPE (GbpServedCompletionProvider, gbp_served_completion_provider, 
IDE_TYPE_LSP_COMPLETION_PROVIDER)
+
+static void
+gbp_served_completion_provider_class_init (GbpServedCompletionProviderClass *klass)
+{
+  IdeLspCompletionProviderClass *lsp_completion_provider_class = IDE_LSP_COMPLETION_PROVIDER_CLASS (klass);
+
+  lsp_completion_provider_class->load = gbp_served_completion_provider_load;
+}
+
+static void
+gbp_served_completion_provider_init (GbpServedCompletionProvider *self)
+{
+}
diff --git a/src/plugins/serve-d/gbp-served-completion-provider.h 
b/src/plugins/serve-d/gbp-served-completion-provider.h
new file mode 100644
index 000000000..9c2f7326b
--- /dev/null
+++ b/src/plugins/serve-d/gbp-served-completion-provider.h
@@ -0,0 +1,31 @@
+/* gbp-served-completion-provider.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 <libide-lsp.h>
+
+G_BEGIN_DECLS
+
+#define GBP_TYPE_SERVED_COMPLETION_PROVIDER (gbp_served_completion_provider_get_type())
+
+G_DECLARE_FINAL_TYPE (GbpServedCompletionProvider, gbp_served_completion_provider, GBP, 
SERVED_COMPLETION_PROVIDER, IdeLspCompletionProvider)
+
+G_END_DECLS
diff --git a/src/plugins/serve-d/gbp-served-diagnostic-provider.c 
b/src/plugins/serve-d/gbp-served-diagnostic-provider.c
new file mode 100644
index 000000000..d67bfc944
--- /dev/null
+++ b/src/plugins/serve-d/gbp-served-diagnostic-provider.c
@@ -0,0 +1,65 @@
+/* gbp-served-diagnostic-provider.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 "gbp-served-diagnostic-provider"
+
+#include "config.h"
+
+#include "gbp-served-diagnostic-provider.h"
+#include "gbp-served-service.h"
+
+struct _GbpServedDiagnosticProvider
+{
+  IdeLspDiagnosticProvider parent_instance;
+};
+
+static void
+gbp_served_diagnostic_provider_load (IdeDiagnosticProvider *provider)
+{
+  g_autoptr(IdeLspServiceClass) klass = NULL;
+
+  IDE_ENTRY;
+
+  g_assert (GBP_IS_SERVED_DIAGNOSTIC_PROVIDER (provider));
+
+  klass = g_type_class_ref (GBP_TYPE_SERVED_SERVICE);
+  ide_lsp_service_class_bind_client (klass, IDE_OBJECT (provider));
+
+  IDE_EXIT;
+}
+
+static void
+diagnostic_provider_iface_init (IdeDiagnosticProviderInterface *iface)
+{
+  iface->load = gbp_served_diagnostic_provider_load;
+}
+
+G_DEFINE_FINAL_TYPE_WITH_CODE (GbpServedDiagnosticProvider, gbp_served_diagnostic_provider, 
IDE_TYPE_LSP_DIAGNOSTIC_PROVIDER,
+                               G_IMPLEMENT_INTERFACE (IDE_TYPE_DIAGNOSTIC_PROVIDER, 
diagnostic_provider_iface_init))
+
+static void
+gbp_served_diagnostic_provider_class_init (GbpServedDiagnosticProviderClass *klass)
+{
+}
+
+static void
+gbp_served_diagnostic_provider_init (GbpServedDiagnosticProvider *self)
+{
+}
diff --git a/src/plugins/serve-d/gbp-served-diagnostic-provider.h 
b/src/plugins/serve-d/gbp-served-diagnostic-provider.h
new file mode 100644
index 000000000..2cf590808
--- /dev/null
+++ b/src/plugins/serve-d/gbp-served-diagnostic-provider.h
@@ -0,0 +1,31 @@
+/* gbp-served-diagnostic-provider.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 <libide-lsp.h>
+
+G_BEGIN_DECLS
+
+#define GBP_TYPE_SERVED_DIAGNOSTIC_PROVIDER (gbp_served_diagnostic_provider_get_type())
+
+G_DECLARE_FINAL_TYPE (GbpServedDiagnosticProvider, gbp_served_diagnostic_provider, GBP, 
SERVED_DIAGNOSTIC_PROVIDER, IdeLspDiagnosticProvider)
+
+G_END_DECLS
diff --git a/src/plugins/serve-d/gbp-served-formatter.c b/src/plugins/serve-d/gbp-served-formatter.c
new file mode 100644
index 000000000..9da6537e4
--- /dev/null
+++ b/src/plugins/serve-d/gbp-served-formatter.c
@@ -0,0 +1,65 @@
+/* gbp-served-formatter.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 "gbp-served-formatter"
+
+#include "config.h"
+
+#include "gbp-served-formatter.h"
+#include "gbp-served-service.h"
+
+struct _GbpServedFormatter
+{
+  IdeLspFormatter parent_instance;
+};
+
+static void
+gbp_served_formatter_load (IdeFormatter *provider)
+{
+  g_autoptr(IdeLspServiceClass) klass = NULL;
+
+  IDE_ENTRY;
+
+  g_assert (GBP_IS_SERVED_FORMATTER (provider));
+
+  klass = g_type_class_ref (GBP_TYPE_SERVED_SERVICE);
+  ide_lsp_service_class_bind_client (klass, IDE_OBJECT (provider));
+
+  IDE_EXIT;
+}
+
+static void
+formatter_iface_init (IdeFormatterInterface *iface)
+{
+  iface->load = gbp_served_formatter_load;
+}
+
+G_DEFINE_FINAL_TYPE_WITH_CODE (GbpServedFormatter, gbp_served_formatter, IDE_TYPE_LSP_FORMATTER,
+                               G_IMPLEMENT_INTERFACE (IDE_TYPE_FORMATTER, formatter_iface_init))
+
+static void
+gbp_served_formatter_class_init (GbpServedFormatterClass *klass)
+{
+}
+
+static void
+gbp_served_formatter_init (GbpServedFormatter *self)
+{
+}
diff --git a/src/plugins/serve-d/gbp-served-formatter.h b/src/plugins/serve-d/gbp-served-formatter.h
new file mode 100644
index 000000000..aba3f4338
--- /dev/null
+++ b/src/plugins/serve-d/gbp-served-formatter.h
@@ -0,0 +1,31 @@
+/* gbp-served-formatter.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 <libide-lsp.h>
+
+G_BEGIN_DECLS
+
+#define GBP_TYPE_SERVED_FORMATTER (gbp_served_formatter_get_type())
+
+G_DECLARE_FINAL_TYPE (GbpServedFormatter, gbp_served_formatter, GBP, SERVED_FORMATTER, IdeLspFormatter)
+
+G_END_DECLS
diff --git a/src/plugins/serve-d/gbp-served-highlighter.c b/src/plugins/serve-d/gbp-served-highlighter.c
new file mode 100644
index 000000000..c2dd8942d
--- /dev/null
+++ b/src/plugins/serve-d/gbp-served-highlighter.c
@@ -0,0 +1,65 @@
+/* gbp-served-highlighter.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 "gbp-served-highlighter"
+
+#include "config.h"
+
+#include "gbp-served-highlighter.h"
+#include "gbp-served-service.h"
+
+struct _GbpServedHighlighter
+{
+  IdeLspHighlighter parent_instance;
+};
+
+static void
+gbp_served_highlighter_load (IdeHighlighter *provider)
+{
+  g_autoptr(IdeLspServiceClass) klass = NULL;
+
+  IDE_ENTRY;
+
+  g_assert (GBP_IS_SERVED_HIGHLIGHTER (provider));
+
+  klass = g_type_class_ref (GBP_TYPE_SERVED_SERVICE);
+  ide_lsp_service_class_bind_client (klass, IDE_OBJECT (provider));
+
+  IDE_EXIT;
+}
+
+static void
+highlighter_iface_init (IdeHighlighterInterface *iface)
+{
+  iface->load = gbp_served_highlighter_load;
+}
+
+G_DEFINE_FINAL_TYPE_WITH_CODE (GbpServedHighlighter, gbp_served_highlighter, IDE_TYPE_LSP_HIGHLIGHTER,
+                               G_IMPLEMENT_INTERFACE (IDE_TYPE_HIGHLIGHTER, highlighter_iface_init))
+
+static void
+gbp_served_highlighter_class_init (GbpServedHighlighterClass *klass)
+{
+}
+
+static void
+gbp_served_highlighter_init (GbpServedHighlighter *self)
+{
+}
diff --git a/src/plugins/serve-d/gbp-served-highlighter.h b/src/plugins/serve-d/gbp-served-highlighter.h
new file mode 100644
index 000000000..dfd152e14
--- /dev/null
+++ b/src/plugins/serve-d/gbp-served-highlighter.h
@@ -0,0 +1,31 @@
+/* gbp-served-highlighter.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 <libide-lsp.h>
+
+G_BEGIN_DECLS
+
+#define GBP_TYPE_SERVED_HIGHLIGHTER (gbp_served_highlighter_get_type())
+
+G_DECLARE_FINAL_TYPE (GbpServedHighlighter, gbp_served_highlighter, GBP, SERVED_HIGHLIGHTER, 
IdeLspHighlighter)
+
+G_END_DECLS
diff --git a/src/plugins/serve-d/gbp-served-hover-provider.c b/src/plugins/serve-d/gbp-served-hover-provider.c
new file mode 100644
index 000000000..c7b519b92
--- /dev/null
+++ b/src/plugins/serve-d/gbp-served-hover-provider.c
@@ -0,0 +1,66 @@
+/* gbp-served-hover-provider.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 "gbp-served-hover-provider"
+
+#include "config.h"
+
+#include "gbp-served-hover-provider.h"
+#include "gbp-served-service.h"
+
+struct _GbpServedHoverProvider
+{
+  IdeLspHoverProvider parent_instance;
+};
+
+static void
+gbp_served_hover_provider_prepare (IdeLspHoverProvider *provider)
+{
+  g_autoptr(IdeLspServiceClass) klass = NULL;
+
+  IDE_ENTRY;
+
+  g_assert (GBP_IS_SERVED_HOVER_PROVIDER (provider));
+
+  g_object_set (provider,
+                "category", "serve-d",
+                "priority", 200,
+                NULL);
+
+  klass = g_type_class_ref (GBP_TYPE_SERVED_SERVICE);
+  ide_lsp_service_class_bind_client (klass, IDE_OBJECT (provider));
+
+  IDE_EXIT;
+}
+
+G_DEFINE_FINAL_TYPE (GbpServedHoverProvider, gbp_served_hover_provider, IDE_TYPE_LSP_HOVER_PROVIDER)
+
+static void
+gbp_served_hover_provider_class_init (GbpServedHoverProviderClass *klass)
+{
+  IdeLspHoverProviderClass *lsp_hover_provider_class = IDE_LSP_HOVER_PROVIDER_CLASS (klass);
+
+  lsp_hover_provider_class->prepare = gbp_served_hover_provider_prepare;
+}
+
+static void
+gbp_served_hover_provider_init (GbpServedHoverProvider *self)
+{
+}
diff --git a/src/plugins/serve-d/gbp-served-hover-provider.h b/src/plugins/serve-d/gbp-served-hover-provider.h
new file mode 100644
index 000000000..d63c957f7
--- /dev/null
+++ b/src/plugins/serve-d/gbp-served-hover-provider.h
@@ -0,0 +1,31 @@
+/* gbp-served-hover-provider.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 <libide-lsp.h>
+
+G_BEGIN_DECLS
+
+#define GBP_TYPE_SERVED_HOVER_PROVIDER (gbp_served_hover_provider_get_type())
+
+G_DECLARE_FINAL_TYPE (GbpServedHoverProvider, gbp_served_hover_provider, GBP, SERVED_HOVER_PROVIDER, 
IdeLspHoverProvider)
+
+G_END_DECLS
diff --git a/src/plugins/serve-d/gbp-served-rename-provider.c 
b/src/plugins/serve-d/gbp-served-rename-provider.c
new file mode 100644
index 000000000..eabeb31ed
--- /dev/null
+++ b/src/plugins/serve-d/gbp-served-rename-provider.c
@@ -0,0 +1,65 @@
+/* gbp-served-rename-provider.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 "gbp-served-rename-provider"
+
+#include "config.h"
+
+#include "gbp-served-rename-provider.h"
+#include "gbp-served-service.h"
+
+struct _GbpServedRenameProvider
+{
+  IdeLspRenameProvider parent_instance;
+};
+
+static void
+gbp_served_rename_provider_load (IdeRenameProvider *provider)
+{
+  g_autoptr(IdeLspServiceClass) klass = NULL;
+
+  IDE_ENTRY;
+
+  g_assert (GBP_IS_SERVED_RENAME_PROVIDER (provider));
+
+  klass = g_type_class_ref (GBP_TYPE_SERVED_SERVICE);
+  ide_lsp_service_class_bind_client (klass, IDE_OBJECT (provider));
+
+  IDE_EXIT;
+}
+
+static void
+rename_provider_iface_init (IdeRenameProviderInterface *iface)
+{
+  iface->load = gbp_served_rename_provider_load;
+}
+
+G_DEFINE_FINAL_TYPE_WITH_CODE (GbpServedRenameProvider, gbp_served_rename_provider, 
IDE_TYPE_LSP_RENAME_PROVIDER,
+                               G_IMPLEMENT_INTERFACE (IDE_TYPE_RENAME_PROVIDER, rename_provider_iface_init))
+
+static void
+gbp_served_rename_provider_class_init (GbpServedRenameProviderClass *klass)
+{
+}
+
+static void
+gbp_served_rename_provider_init (GbpServedRenameProvider *self)
+{
+}
diff --git a/src/plugins/serve-d/gbp-served-rename-provider.h 
b/src/plugins/serve-d/gbp-served-rename-provider.h
new file mode 100644
index 000000000..c093b112b
--- /dev/null
+++ b/src/plugins/serve-d/gbp-served-rename-provider.h
@@ -0,0 +1,31 @@
+/* gbp-served-rename-provider.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 <libide-lsp.h>
+
+G_BEGIN_DECLS
+
+#define GBP_TYPE_SERVED_RENAME_PROVIDER (gbp_served_rename_provider_get_type())
+
+G_DECLARE_FINAL_TYPE (GbpServedRenameProvider, gbp_served_rename_provider, GBP, SERVED_RENAME_PROVIDER, 
IdeLspRenameProvider)
+
+G_END_DECLS
diff --git a/src/plugins/serve-d/gbp-served-service.c b/src/plugins/serve-d/gbp-served-service.c
new file mode 100644
index 000000000..29f7d4d60
--- /dev/null
+++ b/src/plugins/serve-d/gbp-served-service.c
@@ -0,0 +1,62 @@
+/* gbp-served-service.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 "gbp-served-service"
+
+#include "config.h"
+
+#include <jsonrpc-glib.h>
+
+#include "gbp-served-service.h"
+
+struct _GbpServedService
+{
+  IdeLspService parent_instance;
+};
+
+G_DEFINE_FINAL_TYPE (GbpServedService, gbp_served_service, IDE_TYPE_LSP_SERVICE)
+
+static void
+gbp_served_service_configure_client (IdeLspService *service,
+                                     IdeLspClient  *client)
+{
+  IDE_ENTRY;
+
+  g_assert (GBP_IS_SERVED_SERVICE (service));
+  g_assert (IDE_IS_LSP_CLIENT (client));
+
+  ide_lsp_client_add_language (client, "d");
+
+  IDE_EXIT;
+}
+
+static void
+gbp_served_service_class_init (GbpServedServiceClass *klass)
+{
+  IdeLspServiceClass *lsp_service_class = IDE_LSP_SERVICE_CLASS (klass);
+
+  lsp_service_class->configure_client = gbp_served_service_configure_client;
+}
+
+static void
+gbp_served_service_init (GbpServedService *self)
+{
+  ide_lsp_service_set_program (IDE_LSP_SERVICE (self), "serve-d");
+}
diff --git a/src/plugins/serve-d/gbp-served-service.h b/src/plugins/serve-d/gbp-served-service.h
new file mode 100644
index 000000000..6be227a5e
--- /dev/null
+++ b/src/plugins/serve-d/gbp-served-service.h
@@ -0,0 +1,31 @@
+/* gbp-served-service.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 <libide-lsp.h>
+
+G_BEGIN_DECLS
+
+#define GBP_TYPE_SERVED_SERVICE (gbp_served_service_get_type())
+
+G_DECLARE_FINAL_TYPE (GbpServedService, gbp_served_service, GBP, SERVED_SERVICE, IdeLspService)
+
+G_END_DECLS
diff --git a/src/plugins/serve-d/gbp-served-symbol-resolver.c 
b/src/plugins/serve-d/gbp-served-symbol-resolver.c
new file mode 100644
index 000000000..04921e45e
--- /dev/null
+++ b/src/plugins/serve-d/gbp-served-symbol-resolver.c
@@ -0,0 +1,65 @@
+/* gbp-served-symbol-resolver.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 "gbp-served-symbol-resolver"
+
+#include "config.h"
+
+#include "gbp-served-symbol-resolver.h"
+#include "gbp-served-service.h"
+
+struct _GbpServedSymbolResolver
+{
+  IdeLspSymbolResolver parent_instance;
+};
+
+static void
+gbp_served_symbol_provider_load (IdeSymbolResolver *provider)
+{
+  g_autoptr(IdeLspServiceClass) klass = NULL;
+
+  IDE_ENTRY;
+
+  g_assert (GBP_IS_SERVED_SYMBOL_RESOLVER (provider));
+
+  klass = g_type_class_ref (GBP_TYPE_SERVED_SERVICE);
+  ide_lsp_service_class_bind_client (klass, IDE_OBJECT (provider));
+
+  IDE_EXIT;
+}
+
+static void
+symbol_provider_iface_init (IdeSymbolResolverInterface *iface)
+{
+  iface->load = gbp_served_symbol_provider_load;
+}
+
+G_DEFINE_FINAL_TYPE_WITH_CODE (GbpServedSymbolResolver, gbp_served_symbol_provider, 
IDE_TYPE_LSP_SYMBOL_RESOLVER,
+                               G_IMPLEMENT_INTERFACE (IDE_TYPE_SYMBOL_RESOLVER, symbol_provider_iface_init))
+
+static void
+gbp_served_symbol_provider_class_init (GbpServedSymbolResolverClass *klass)
+{
+}
+
+static void
+gbp_served_symbol_provider_init (GbpServedSymbolResolver *self)
+{
+}
diff --git a/src/plugins/serve-d/gbp-served-symbol-resolver.h 
b/src/plugins/serve-d/gbp-served-symbol-resolver.h
new file mode 100644
index 000000000..9bb8bd903
--- /dev/null
+++ b/src/plugins/serve-d/gbp-served-symbol-resolver.h
@@ -0,0 +1,31 @@
+/* gbp-served-symbol-resolver.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 <libide-lsp.h>
+
+G_BEGIN_DECLS
+
+#define GBP_TYPE_SERVED_SYMBOL_RESOLVER (gbp_served_symbol_provider_get_type())
+
+G_DECLARE_FINAL_TYPE (GbpServedSymbolResolver, gbp_served_symbol_provider, GBP, SERVED_SYMBOL_RESOLVER, 
IdeLspSymbolResolver)
+
+G_END_DECLS
diff --git a/src/plugins/serve-d/meson.build b/src/plugins/serve-d/meson.build
new file mode 100644
index 000000000..67b4ba6c2
--- /dev/null
+++ b/src/plugins/serve-d/meson.build
@@ -0,0 +1,24 @@
+if get_option('plugin_serve_d')
+
+plugins_sources += files([
+  'serve-d-plugin.c',
+  'gbp-served-code-action-provider.c',
+  'gbp-served-completion-provider.c',
+  'gbp-served-diagnostic-provider.c',
+  'gbp-served-formatter.c',
+  'gbp-served-highlighter.c',
+  'gbp-served-hover-provider.c',
+  'gbp-served-rename-provider.c',
+  'gbp-served-symbol-resolver.c',
+  'gbp-served-service.c',
+])
+
+plugin_served_resources = gnome.compile_resources(
+  'serve-d-resources',
+  'serve-d.gresource.xml',
+  c_name: 'gbp_served',
+)
+
+plugins_sources += plugin_served_resources
+
+endif
diff --git a/src/plugins/serve-d/serve-d-plugin.c b/src/plugins/serve-d/serve-d-plugin.c
new file mode 100644
index 000000000..58a3ebc75
--- /dev/null
+++ b/src/plugins/serve-d/serve-d-plugin.c
@@ -0,0 +1,68 @@
+/* serve-d-plugin.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 "serve-d-plugin"
+
+#include "config.h"
+
+#include <libpeas/peas.h>
+
+#include <libide-code.h>
+#include <libide-foundry.h>
+#include <libide-lsp.h>
+
+#include "gbp-served-service.h"
+#include "gbp-served-completion-provider.h"
+#include "gbp-served-diagnostic-provider.h"
+#include "gbp-served-symbol-resolver.h"
+#include "gbp-served-highlighter.h"
+#include "gbp-served-formatter.h"
+#include "gbp-served-rename-provider.h"
+#include "gbp-served-hover-provider.h"
+#include "gbp-served-code-action-provider.h"
+
+_IDE_EXTERN void
+_gbp_served_register_types (PeasObjectModule *module)
+{
+  peas_object_module_register_extension_type (module,
+                                              IDE_TYPE_DIAGNOSTIC_PROVIDER,
+                                              GBP_TYPE_SERVED_DIAGNOSTIC_PROVIDER);
+  peas_object_module_register_extension_type (module,
+                                              GTK_SOURCE_TYPE_COMPLETION_PROVIDER,
+                                              GBP_TYPE_SERVED_COMPLETION_PROVIDER);
+  peas_object_module_register_extension_type (module,
+                                              IDE_TYPE_SYMBOL_RESOLVER,
+                                              GBP_TYPE_SERVED_SYMBOL_RESOLVER);
+  peas_object_module_register_extension_type (module,
+                                              IDE_TYPE_HIGHLIGHTER,
+                                              GBP_TYPE_SERVED_HIGHLIGHTER);
+  peas_object_module_register_extension_type (module,
+                                              IDE_TYPE_FORMATTER,
+                                              GBP_TYPE_SERVED_FORMATTER);
+  peas_object_module_register_extension_type (module,
+                                              GTK_SOURCE_TYPE_HOVER_PROVIDER,
+                                              GBP_TYPE_SERVED_HOVER_PROVIDER);
+  peas_object_module_register_extension_type (module,
+                                              IDE_TYPE_RENAME_PROVIDER,
+                                              GBP_TYPE_SERVED_RENAME_PROVIDER);
+  peas_object_module_register_extension_type (module,
+                                              IDE_TYPE_CODE_ACTION_PROVIDER,
+                                              GBP_TYPE_SERVED_CODE_ACTION_PROVIDER);
+}
diff --git a/src/plugins/serve-d/serve-d.gresource.xml b/src/plugins/serve-d/serve-d.gresource.xml
new file mode 100644
index 000000000..7cf0a1f10
--- /dev/null
+++ b/src/plugins/serve-d/serve-d.gresource.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+  <gresource prefix="/plugins/serve-d">
+    <file>serve-d.plugin</file>
+  </gresource>
+</gresources>
diff --git a/src/plugins/serve-d/serve-d.plugin b/src/plugins/serve-d/serve-d.plugin
new file mode 100644
index 000000000..86f84b713
--- /dev/null
+++ b/src/plugins/serve-d/serve-d.plugin
@@ -0,0 +1,16 @@
+[Plugin]
+Builtin=true
+Copyright=Copyright © 2022 Christian Hergert
+Description=Provides integration with the serve-d language server for D
+Embedded=_gbp_served_register_types
+Module=serve-d
+Name=D Language Server (serve-d)
+X-Category=lsps
+X-Completion-Provider-Languages=d
+X-Symbol-Resolver-Languages=d
+X-Diagnostic-Provider-Languages=d
+X-Highlighter-Languages=d
+X-Hover-Provider-Languages=d
+X-Rename-Provider-Languages=d
+X-Formatter-Languages=d
+X-Code-Action-Languages=d


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