[gnome-builder] plugins/jdtls: add support for jdtls and port prototype to C



commit a4f0969eef0b2ebf017a20cf7000b16ae6d6ea32
Author: Christian Hergert <chergert redhat com>
Date:   Mon Jul 11 22:57:21 2022 -0700

    plugins/jdtls: add support for jdtls and port prototype to C

 src/plugins/jdtls/README.md                        |  7 ++
 src/plugins/jdtls/gbp-jdtls-code-action-provider.c | 65 +++++++++++++++++++
 src/plugins/jdtls/gbp-jdtls-code-action-provider.h | 31 +++++++++
 src/plugins/jdtls/gbp-jdtls-completion-provider.c  | 75 ++++++++++++++++++++++
 src/plugins/jdtls/gbp-jdtls-completion-provider.h  | 31 +++++++++
 src/plugins/jdtls/gbp-jdtls-diagnostic-provider.c  | 65 +++++++++++++++++++
 src/plugins/jdtls/gbp-jdtls-diagnostic-provider.h  | 31 +++++++++
 src/plugins/jdtls/gbp-jdtls-formatter.c            | 65 +++++++++++++++++++
 src/plugins/jdtls/gbp-jdtls-formatter.h            | 31 +++++++++
 src/plugins/jdtls/gbp-jdtls-highlighter.c          | 65 +++++++++++++++++++
 src/plugins/jdtls/gbp-jdtls-highlighter.h          | 31 +++++++++
 src/plugins/jdtls/gbp-jdtls-hover-provider.c       | 66 +++++++++++++++++++
 src/plugins/jdtls/gbp-jdtls-hover-provider.h       | 31 +++++++++
 src/plugins/jdtls/gbp-jdtls-rename-provider.c      | 65 +++++++++++++++++++
 src/plugins/jdtls/gbp-jdtls-rename-provider.h      | 31 +++++++++
 src/plugins/jdtls/gbp-jdtls-service.c              | 65 +++++++++++++++++++
 src/plugins/jdtls/gbp-jdtls-service.h              | 31 +++++++++
 src/plugins/jdtls/gbp-jdtls-symbol-resolver.c      | 65 +++++++++++++++++++
 src/plugins/jdtls/gbp-jdtls-symbol-resolver.h      | 31 +++++++++
 src/plugins/jdtls/jdtls-plugin.c                   | 68 ++++++++++++++++++++
 src/plugins/jdtls/jdtls.gresource.xml              |  6 ++
 src/plugins/jdtls/jdtls.plugin                     | 16 +++++
 src/plugins/jdtls/meson.build                      | 24 +++++++
 23 files changed, 996 insertions(+)
---
diff --git a/src/plugins/jdtls/README.md b/src/plugins/jdtls/README.md
new file mode 100644
index 000000000..4c326b2a1
--- /dev/null
+++ b/src/plugins/jdtls/README.md
@@ -0,0 +1,7 @@
+You can get jdtls from somewhere like https://download.eclipse.org/jdtls/milestones/1.9.0/
+
+Extract it and symlink to it from somewhere in your $PATH like:
+
+ ln -s ~/Downloads/jdt-language-server-1.9.0-202203031534/bin/jdtls ~/.local/bin/jdtls
+
+Then Builder (assuming `.local/bin` is in your $PATH) will find it and spawn it for .java files for you.
diff --git a/src/plugins/jdtls/gbp-jdtls-code-action-provider.c 
b/src/plugins/jdtls/gbp-jdtls-code-action-provider.c
new file mode 100644
index 000000000..7dc5bb81e
--- /dev/null
+++ b/src/plugins/jdtls/gbp-jdtls-code-action-provider.c
@@ -0,0 +1,65 @@
+/* gbp-jdtls-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-jdtls-code-action-provider"
+
+#include "config.h"
+
+#include "gbp-jdtls-code-action-provider.h"
+#include "gbp-jdtls-service.h"
+
+struct _GbpJdtlsCodeActionProvider
+{
+  IdeLspCodeActionProvider parent_instance;
+};
+
+static void
+gbp_jdtls_code_action_provider_load (IdeCodeActionProvider *provider)
+{
+  g_autoptr(IdeLspServiceClass) klass = NULL;
+
+  IDE_ENTRY;
+
+  g_assert (GBP_IS_JDTLS_CODE_ACTION_PROVIDER (provider));
+
+  klass = g_type_class_ref (GBP_TYPE_JDTLS_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_jdtls_code_action_provider_load;
+}
+
+G_DEFINE_FINAL_TYPE_WITH_CODE (GbpJdtlsCodeActionProvider, gbp_jdtls_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_jdtls_code_action_provider_class_init (GbpJdtlsCodeActionProviderClass *klass)
+{
+}
+
+static void
+gbp_jdtls_code_action_provider_init (GbpJdtlsCodeActionProvider *self)
+{
+}
diff --git a/src/plugins/jdtls/gbp-jdtls-code-action-provider.h 
b/src/plugins/jdtls/gbp-jdtls-code-action-provider.h
new file mode 100644
index 000000000..9fe411a88
--- /dev/null
+++ b/src/plugins/jdtls/gbp-jdtls-code-action-provider.h
@@ -0,0 +1,31 @@
+/* gbp-jdtls-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_JDTLS_CODE_ACTION_PROVIDER (gbp_jdtls_code_action_provider_get_type())
+
+G_DECLARE_FINAL_TYPE (GbpJdtlsCodeActionProvider, gbp_jdtls_code_action_provider, GBP, 
JDTLS_CODE_ACTION_PROVIDER, IdeLspCodeActionProvider)
+
+G_END_DECLS
diff --git a/src/plugins/jdtls/gbp-jdtls-completion-provider.c 
b/src/plugins/jdtls/gbp-jdtls-completion-provider.c
new file mode 100644
index 000000000..a81417141
--- /dev/null
+++ b/src/plugins/jdtls/gbp-jdtls-completion-provider.c
@@ -0,0 +1,75 @@
+/* gbp-jdtls-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-jdtls-completion-provider"
+
+#include "config.h"
+
+#include "gbp-jdtls-completion-provider.h"
+#include "gbp-jdtls-service.h"
+
+struct _GbpJdtlsCompletionProvider
+{
+  IdeLspCompletionProvider parent_instance;
+};
+
+static void
+gbp_jdtls_completion_provider_load (IdeLspCompletionProvider *provider)
+{
+  g_autoptr(IdeLspServiceClass) klass = NULL;
+
+  IDE_ENTRY;
+
+  g_assert (GBP_IS_JDTLS_COMPLETION_PROVIDER (provider));
+
+  klass = g_type_class_ref (GBP_TYPE_JDTLS_SERVICE);
+  ide_lsp_service_class_bind_client (klass, IDE_OBJECT (provider));
+
+  IDE_EXIT;
+}
+
+static int
+gbp_jdtls_completion_provider_get_priority (GtkSourceCompletionProvider *provider,
+                                           GtkSourceCompletionContext  *context)
+{
+  return -1000;
+}
+
+static void
+completion_provider_iface_init (GtkSourceCompletionProviderInterface *iface)
+{
+  iface->get_priority = gbp_jdtls_completion_provider_get_priority;
+}
+
+G_DEFINE_FINAL_TYPE_WITH_CODE (GbpJdtlsCompletionProvider, gbp_jdtls_completion_provider, 
IDE_TYPE_LSP_COMPLETION_PROVIDER,
+                               G_IMPLEMENT_INTERFACE (GTK_SOURCE_TYPE_COMPLETION_PROVIDER, 
completion_provider_iface_init))
+
+static void
+gbp_jdtls_completion_provider_class_init (GbpJdtlsCompletionProviderClass *klass)
+{
+  IdeLspCompletionProviderClass *lsp_completion_provider_class = IDE_LSP_COMPLETION_PROVIDER_CLASS (klass);
+
+  lsp_completion_provider_class->load = gbp_jdtls_completion_provider_load;
+}
+
+static void
+gbp_jdtls_completion_provider_init (GbpJdtlsCompletionProvider *self)
+{
+}
diff --git a/src/plugins/jdtls/gbp-jdtls-completion-provider.h 
b/src/plugins/jdtls/gbp-jdtls-completion-provider.h
new file mode 100644
index 000000000..ec158e7bc
--- /dev/null
+++ b/src/plugins/jdtls/gbp-jdtls-completion-provider.h
@@ -0,0 +1,31 @@
+/* gbp-jdtls-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_JDTLS_COMPLETION_PROVIDER (gbp_jdtls_completion_provider_get_type())
+
+G_DECLARE_FINAL_TYPE (GbpJdtlsCompletionProvider, gbp_jdtls_completion_provider, GBP, 
JDTLS_COMPLETION_PROVIDER, IdeLspCompletionProvider)
+
+G_END_DECLS
diff --git a/src/plugins/jdtls/gbp-jdtls-diagnostic-provider.c 
b/src/plugins/jdtls/gbp-jdtls-diagnostic-provider.c
new file mode 100644
index 000000000..20bef8f9b
--- /dev/null
+++ b/src/plugins/jdtls/gbp-jdtls-diagnostic-provider.c
@@ -0,0 +1,65 @@
+/* gbp-jdtls-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-jdtls-diagnostic-provider"
+
+#include "config.h"
+
+#include "gbp-jdtls-diagnostic-provider.h"
+#include "gbp-jdtls-service.h"
+
+struct _GbpJdtlsDiagnosticProvider
+{
+  IdeLspDiagnosticProvider parent_instance;
+};
+
+static void
+gbp_jdtls_diagnostic_provider_load (IdeDiagnosticProvider *provider)
+{
+  g_autoptr(IdeLspServiceClass) klass = NULL;
+
+  IDE_ENTRY;
+
+  g_assert (GBP_IS_JDTLS_DIAGNOSTIC_PROVIDER (provider));
+
+  klass = g_type_class_ref (GBP_TYPE_JDTLS_SERVICE);
+  ide_lsp_service_class_bind_client (klass, IDE_OBJECT (provider));
+
+  IDE_EXIT;
+}
+
+static void
+diagnostic_provider_iface_init (IdeDiagnosticProviderInterface *iface)
+{
+  iface->load = gbp_jdtls_diagnostic_provider_load;
+}
+
+G_DEFINE_FINAL_TYPE_WITH_CODE (GbpJdtlsDiagnosticProvider, gbp_jdtls_diagnostic_provider, 
IDE_TYPE_LSP_DIAGNOSTIC_PROVIDER,
+                               G_IMPLEMENT_INTERFACE (IDE_TYPE_DIAGNOSTIC_PROVIDER, 
diagnostic_provider_iface_init))
+
+static void
+gbp_jdtls_diagnostic_provider_class_init (GbpJdtlsDiagnosticProviderClass *klass)
+{
+}
+
+static void
+gbp_jdtls_diagnostic_provider_init (GbpJdtlsDiagnosticProvider *self)
+{
+}
diff --git a/src/plugins/jdtls/gbp-jdtls-diagnostic-provider.h 
b/src/plugins/jdtls/gbp-jdtls-diagnostic-provider.h
new file mode 100644
index 000000000..e9b39a310
--- /dev/null
+++ b/src/plugins/jdtls/gbp-jdtls-diagnostic-provider.h
@@ -0,0 +1,31 @@
+/* gbp-jdtls-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_JDTLS_DIAGNOSTIC_PROVIDER (gbp_jdtls_diagnostic_provider_get_type())
+
+G_DECLARE_FINAL_TYPE (GbpJdtlsDiagnosticProvider, gbp_jdtls_diagnostic_provider, GBP, 
JDTLS_DIAGNOSTIC_PROVIDER, IdeLspDiagnosticProvider)
+
+G_END_DECLS
diff --git a/src/plugins/jdtls/gbp-jdtls-formatter.c b/src/plugins/jdtls/gbp-jdtls-formatter.c
new file mode 100644
index 000000000..60d237052
--- /dev/null
+++ b/src/plugins/jdtls/gbp-jdtls-formatter.c
@@ -0,0 +1,65 @@
+/* gbp-jdtls-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-jdtls-formatter"
+
+#include "config.h"
+
+#include "gbp-jdtls-formatter.h"
+#include "gbp-jdtls-service.h"
+
+struct _GbpJdtlsFormatter
+{
+  IdeLspFormatter parent_instance;
+};
+
+static void
+gbp_jdtls_formatter_load (IdeFormatter *provider)
+{
+  g_autoptr(IdeLspServiceClass) klass = NULL;
+
+  IDE_ENTRY;
+
+  g_assert (GBP_IS_JDTLS_FORMATTER (provider));
+
+  klass = g_type_class_ref (GBP_TYPE_JDTLS_SERVICE);
+  ide_lsp_service_class_bind_client (klass, IDE_OBJECT (provider));
+
+  IDE_EXIT;
+}
+
+static void
+formatter_iface_init (IdeFormatterInterface *iface)
+{
+  iface->load = gbp_jdtls_formatter_load;
+}
+
+G_DEFINE_FINAL_TYPE_WITH_CODE (GbpJdtlsFormatter, gbp_jdtls_formatter, IDE_TYPE_LSP_FORMATTER,
+                               G_IMPLEMENT_INTERFACE (IDE_TYPE_FORMATTER, formatter_iface_init))
+
+static void
+gbp_jdtls_formatter_class_init (GbpJdtlsFormatterClass *klass)
+{
+}
+
+static void
+gbp_jdtls_formatter_init (GbpJdtlsFormatter *self)
+{
+}
diff --git a/src/plugins/jdtls/gbp-jdtls-formatter.h b/src/plugins/jdtls/gbp-jdtls-formatter.h
new file mode 100644
index 000000000..08d9934c6
--- /dev/null
+++ b/src/plugins/jdtls/gbp-jdtls-formatter.h
@@ -0,0 +1,31 @@
+/* gbp-jdtls-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_JDTLS_FORMATTER (gbp_jdtls_formatter_get_type())
+
+G_DECLARE_FINAL_TYPE (GbpJdtlsFormatter, gbp_jdtls_formatter, GBP, JDTLS_FORMATTER, IdeLspFormatter)
+
+G_END_DECLS
diff --git a/src/plugins/jdtls/gbp-jdtls-highlighter.c b/src/plugins/jdtls/gbp-jdtls-highlighter.c
new file mode 100644
index 000000000..dd537d71b
--- /dev/null
+++ b/src/plugins/jdtls/gbp-jdtls-highlighter.c
@@ -0,0 +1,65 @@
+/* gbp-jdtls-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-jdtls-highlighter"
+
+#include "config.h"
+
+#include "gbp-jdtls-highlighter.h"
+#include "gbp-jdtls-service.h"
+
+struct _GbpJdtlsHighlighter
+{
+  IdeLspHighlighter parent_instance;
+};
+
+static void
+gbp_jdtls_highlighter_load (IdeHighlighter *provider)
+{
+  g_autoptr(IdeLspServiceClass) klass = NULL;
+
+  IDE_ENTRY;
+
+  g_assert (GBP_IS_JDTLS_HIGHLIGHTER (provider));
+
+  klass = g_type_class_ref (GBP_TYPE_JDTLS_SERVICE);
+  ide_lsp_service_class_bind_client (klass, IDE_OBJECT (provider));
+
+  IDE_EXIT;
+}
+
+static void
+highlighter_iface_init (IdeHighlighterInterface *iface)
+{
+  iface->load = gbp_jdtls_highlighter_load;
+}
+
+G_DEFINE_FINAL_TYPE_WITH_CODE (GbpJdtlsHighlighter, gbp_jdtls_highlighter, IDE_TYPE_LSP_HIGHLIGHTER,
+                               G_IMPLEMENT_INTERFACE (IDE_TYPE_HIGHLIGHTER, highlighter_iface_init))
+
+static void
+gbp_jdtls_highlighter_class_init (GbpJdtlsHighlighterClass *klass)
+{
+}
+
+static void
+gbp_jdtls_highlighter_init (GbpJdtlsHighlighter *self)
+{
+}
diff --git a/src/plugins/jdtls/gbp-jdtls-highlighter.h b/src/plugins/jdtls/gbp-jdtls-highlighter.h
new file mode 100644
index 000000000..a255d9b1e
--- /dev/null
+++ b/src/plugins/jdtls/gbp-jdtls-highlighter.h
@@ -0,0 +1,31 @@
+/* gbp-jdtls-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_JDTLS_HIGHLIGHTER (gbp_jdtls_highlighter_get_type())
+
+G_DECLARE_FINAL_TYPE (GbpJdtlsHighlighter, gbp_jdtls_highlighter, GBP, JDTLS_HIGHLIGHTER, IdeLspHighlighter)
+
+G_END_DECLS
diff --git a/src/plugins/jdtls/gbp-jdtls-hover-provider.c b/src/plugins/jdtls/gbp-jdtls-hover-provider.c
new file mode 100644
index 000000000..213b8e130
--- /dev/null
+++ b/src/plugins/jdtls/gbp-jdtls-hover-provider.c
@@ -0,0 +1,66 @@
+/* gbp-jdtls-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-jdtls-hover-provider"
+
+#include "config.h"
+
+#include "gbp-jdtls-hover-provider.h"
+#include "gbp-jdtls-service.h"
+
+struct _GbpJdtlsHoverProvider
+{
+  IdeLspHoverProvider parent_instance;
+};
+
+static void
+gbp_jdtls_hover_provider_prepare (IdeLspHoverProvider *provider)
+{
+  g_autoptr(IdeLspServiceClass) klass = NULL;
+
+  IDE_ENTRY;
+
+  g_assert (GBP_IS_JDTLS_HOVER_PROVIDER (provider));
+
+  g_object_set (provider,
+                "category", "Go",
+                "priority", 100,
+                NULL);
+
+  klass = g_type_class_ref (GBP_TYPE_JDTLS_SERVICE);
+  ide_lsp_service_class_bind_client (klass, IDE_OBJECT (provider));
+
+  IDE_EXIT;
+}
+
+G_DEFINE_FINAL_TYPE (GbpJdtlsHoverProvider, gbp_jdtls_hover_provider, IDE_TYPE_LSP_HOVER_PROVIDER)
+
+static void
+gbp_jdtls_hover_provider_class_init (GbpJdtlsHoverProviderClass *klass)
+{
+  IdeLspHoverProviderClass *lsp_hover_provider_class = IDE_LSP_HOVER_PROVIDER_CLASS (klass);
+
+  lsp_hover_provider_class->prepare = gbp_jdtls_hover_provider_prepare;
+}
+
+static void
+gbp_jdtls_hover_provider_init (GbpJdtlsHoverProvider *self)
+{
+}
diff --git a/src/plugins/jdtls/gbp-jdtls-hover-provider.h b/src/plugins/jdtls/gbp-jdtls-hover-provider.h
new file mode 100644
index 000000000..a93c83ad5
--- /dev/null
+++ b/src/plugins/jdtls/gbp-jdtls-hover-provider.h
@@ -0,0 +1,31 @@
+/* gbp-jdtls-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_JDTLS_HOVER_PROVIDER (gbp_jdtls_hover_provider_get_type())
+
+G_DECLARE_FINAL_TYPE (GbpJdtlsHoverProvider, gbp_jdtls_hover_provider, GBP, JDTLS_HOVER_PROVIDER, 
IdeLspHoverProvider)
+
+G_END_DECLS
diff --git a/src/plugins/jdtls/gbp-jdtls-rename-provider.c b/src/plugins/jdtls/gbp-jdtls-rename-provider.c
new file mode 100644
index 000000000..8b24db2f2
--- /dev/null
+++ b/src/plugins/jdtls/gbp-jdtls-rename-provider.c
@@ -0,0 +1,65 @@
+/* gbp-jdtls-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-jdtls-rename-provider"
+
+#include "config.h"
+
+#include "gbp-jdtls-rename-provider.h"
+#include "gbp-jdtls-service.h"
+
+struct _GbpJdtlsRenameProvider
+{
+  IdeLspRenameProvider parent_instance;
+};
+
+static void
+gbp_jdtls_rename_provider_load (IdeRenameProvider *provider)
+{
+  g_autoptr(IdeLspServiceClass) klass = NULL;
+
+  IDE_ENTRY;
+
+  g_assert (GBP_IS_JDTLS_RENAME_PROVIDER (provider));
+
+  klass = g_type_class_ref (GBP_TYPE_JDTLS_SERVICE);
+  ide_lsp_service_class_bind_client (klass, IDE_OBJECT (provider));
+
+  IDE_EXIT;
+}
+
+static void
+rename_provider_iface_init (IdeRenameProviderInterface *iface)
+{
+  iface->load = gbp_jdtls_rename_provider_load;
+}
+
+G_DEFINE_FINAL_TYPE_WITH_CODE (GbpJdtlsRenameProvider, gbp_jdtls_rename_provider, 
IDE_TYPE_LSP_RENAME_PROVIDER,
+                               G_IMPLEMENT_INTERFACE (IDE_TYPE_RENAME_PROVIDER, rename_provider_iface_init))
+
+static void
+gbp_jdtls_rename_provider_class_init (GbpJdtlsRenameProviderClass *klass)
+{
+}
+
+static void
+gbp_jdtls_rename_provider_init (GbpJdtlsRenameProvider *self)
+{
+}
diff --git a/src/plugins/jdtls/gbp-jdtls-rename-provider.h b/src/plugins/jdtls/gbp-jdtls-rename-provider.h
new file mode 100644
index 000000000..5105be6f9
--- /dev/null
+++ b/src/plugins/jdtls/gbp-jdtls-rename-provider.h
@@ -0,0 +1,31 @@
+/* gbp-jdtls-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_JDTLS_RENAME_PROVIDER (gbp_jdtls_rename_provider_get_type())
+
+G_DECLARE_FINAL_TYPE (GbpJdtlsRenameProvider, gbp_jdtls_rename_provider, GBP, JDTLS_RENAME_PROVIDER, 
IdeLspRenameProvider)
+
+G_END_DECLS
diff --git a/src/plugins/jdtls/gbp-jdtls-service.c b/src/plugins/jdtls/gbp-jdtls-service.c
new file mode 100644
index 000000000..ba58ec2de
--- /dev/null
+++ b/src/plugins/jdtls/gbp-jdtls-service.c
@@ -0,0 +1,65 @@
+/* gbp-jdtls-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-jdtls-service"
+
+#include "config.h"
+
+#include <jsonrpc-glib.h>
+
+#include <libide-io.h>
+#include <libide-threading.h>
+
+#include "gbp-jdtls-service.h"
+
+struct _GbpJdtlsService
+{
+  IdeLspService parent_instance;
+};
+
+G_DEFINE_FINAL_TYPE (GbpJdtlsService, gbp_jdtls_service, IDE_TYPE_LSP_SERVICE)
+
+static void
+gbp_jdtls_service_configure_client (IdeLspService *service,
+                                    IdeLspClient  *client)
+{
+  IDE_ENTRY;
+
+  g_assert (GBP_IS_JDTLS_SERVICE (service));
+  g_assert (IDE_IS_LSP_CLIENT (client));
+
+  ide_lsp_client_add_language (client, "java");
+
+  IDE_EXIT;
+}
+
+static void
+gbp_jdtls_service_class_init (GbpJdtlsServiceClass *klass)
+{
+  IdeLspServiceClass *lsp_service_class = IDE_LSP_SERVICE_CLASS (klass);
+
+  lsp_service_class->configure_client = gbp_jdtls_service_configure_client;
+}
+
+static void
+gbp_jdtls_service_init (GbpJdtlsService *self)
+{
+  ide_lsp_service_set_program (IDE_LSP_SERVICE (self), "jdtls");
+}
diff --git a/src/plugins/jdtls/gbp-jdtls-service.h b/src/plugins/jdtls/gbp-jdtls-service.h
new file mode 100644
index 000000000..045fcbafa
--- /dev/null
+++ b/src/plugins/jdtls/gbp-jdtls-service.h
@@ -0,0 +1,31 @@
+/* gbp-jdtls-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_JDTLS_SERVICE (gbp_jdtls_service_get_type())
+
+G_DECLARE_FINAL_TYPE (GbpJdtlsService, gbp_jdtls_service, GBP, JDTLS_SERVICE, IdeLspService)
+
+G_END_DECLS
diff --git a/src/plugins/jdtls/gbp-jdtls-symbol-resolver.c b/src/plugins/jdtls/gbp-jdtls-symbol-resolver.c
new file mode 100644
index 000000000..0812c416d
--- /dev/null
+++ b/src/plugins/jdtls/gbp-jdtls-symbol-resolver.c
@@ -0,0 +1,65 @@
+/* gbp-jdtls-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-jdtls-symbol-resolver"
+
+#include "config.h"
+
+#include "gbp-jdtls-symbol-resolver.h"
+#include "gbp-jdtls-service.h"
+
+struct _GbpJdtlsSymbolResolver
+{
+  IdeLspSymbolResolver parent_instance;
+};
+
+static void
+gbp_jdtls_symbol_provider_load (IdeSymbolResolver *provider)
+{
+  g_autoptr(IdeLspServiceClass) klass = NULL;
+
+  IDE_ENTRY;
+
+  g_assert (GBP_IS_JDTLS_SYMBOL_RESOLVER (provider));
+
+  klass = g_type_class_ref (GBP_TYPE_JDTLS_SERVICE);
+  ide_lsp_service_class_bind_client (klass, IDE_OBJECT (provider));
+
+  IDE_EXIT;
+}
+
+static void
+symbol_provider_iface_init (IdeSymbolResolverInterface *iface)
+{
+  iface->load = gbp_jdtls_symbol_provider_load;
+}
+
+G_DEFINE_FINAL_TYPE_WITH_CODE (GbpJdtlsSymbolResolver, gbp_jdtls_symbol_provider, 
IDE_TYPE_LSP_SYMBOL_RESOLVER,
+                               G_IMPLEMENT_INTERFACE (IDE_TYPE_SYMBOL_RESOLVER, symbol_provider_iface_init))
+
+static void
+gbp_jdtls_symbol_provider_class_init (GbpJdtlsSymbolResolverClass *klass)
+{
+}
+
+static void
+gbp_jdtls_symbol_provider_init (GbpJdtlsSymbolResolver *self)
+{
+}
diff --git a/src/plugins/jdtls/gbp-jdtls-symbol-resolver.h b/src/plugins/jdtls/gbp-jdtls-symbol-resolver.h
new file mode 100644
index 000000000..708c1b040
--- /dev/null
+++ b/src/plugins/jdtls/gbp-jdtls-symbol-resolver.h
@@ -0,0 +1,31 @@
+/* gbp-jdtls-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_JDTLS_SYMBOL_RESOLVER (gbp_jdtls_symbol_provider_get_type())
+
+G_DECLARE_FINAL_TYPE (GbpJdtlsSymbolResolver, gbp_jdtls_symbol_provider, GBP, JDTLS_SYMBOL_RESOLVER, 
IdeLspSymbolResolver)
+
+G_END_DECLS
diff --git a/src/plugins/jdtls/jdtls-plugin.c b/src/plugins/jdtls/jdtls-plugin.c
new file mode 100644
index 000000000..1fb67fd68
--- /dev/null
+++ b/src/plugins/jdtls/jdtls-plugin.c
@@ -0,0 +1,68 @@
+/* jdtls-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 "jdtls-plugin"
+
+#include "config.h"
+
+#include <libpeas/peas.h>
+
+#include <libide-code.h>
+#include <libide-foundry.h>
+#include <libide-lsp.h>
+
+#include "gbp-jdtls-service.h"
+#include "gbp-jdtls-completion-provider.h"
+#include "gbp-jdtls-diagnostic-provider.h"
+#include "gbp-jdtls-symbol-resolver.h"
+#include "gbp-jdtls-highlighter.h"
+#include "gbp-jdtls-formatter.h"
+#include "gbp-jdtls-rename-provider.h"
+#include "gbp-jdtls-hover-provider.h"
+#include "gbp-jdtls-code-action-provider.h"
+
+_IDE_EXTERN void
+_gbp_jdtls_register_types (PeasObjectModule *module)
+{
+  peas_object_module_register_extension_type (module,
+                                              IDE_TYPE_DIAGNOSTIC_PROVIDER,
+                                              GBP_TYPE_JDTLS_DIAGNOSTIC_PROVIDER);
+  peas_object_module_register_extension_type (module,
+                                              GTK_SOURCE_TYPE_COMPLETION_PROVIDER,
+                                              GBP_TYPE_JDTLS_COMPLETION_PROVIDER);
+  peas_object_module_register_extension_type (module,
+                                              IDE_TYPE_SYMBOL_RESOLVER,
+                                              GBP_TYPE_JDTLS_SYMBOL_RESOLVER);
+  peas_object_module_register_extension_type (module,
+                                              IDE_TYPE_HIGHLIGHTER,
+                                              GBP_TYPE_JDTLS_HIGHLIGHTER);
+  peas_object_module_register_extension_type (module,
+                                              IDE_TYPE_FORMATTER,
+                                              GBP_TYPE_JDTLS_FORMATTER);
+  peas_object_module_register_extension_type (module,
+                                              GTK_SOURCE_TYPE_HOVER_PROVIDER,
+                                              GBP_TYPE_JDTLS_HOVER_PROVIDER);
+  peas_object_module_register_extension_type (module,
+                                              IDE_TYPE_RENAME_PROVIDER,
+                                              GBP_TYPE_JDTLS_RENAME_PROVIDER);
+  peas_object_module_register_extension_type (module,
+                                              IDE_TYPE_CODE_ACTION_PROVIDER,
+                                              GBP_TYPE_JDTLS_CODE_ACTION_PROVIDER);
+}
diff --git a/src/plugins/jdtls/jdtls.gresource.xml b/src/plugins/jdtls/jdtls.gresource.xml
new file mode 100644
index 000000000..7ac83aef8
--- /dev/null
+++ b/src/plugins/jdtls/jdtls.gresource.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+  <gresource prefix="/plugins/jdtls">
+    <file>jdtls.plugin</file>
+  </gresource>
+</gresources>
diff --git a/src/plugins/jdtls/jdtls.plugin b/src/plugins/jdtls/jdtls.plugin
new file mode 100644
index 000000000..f6ca24ab9
--- /dev/null
+++ b/src/plugins/jdtls/jdtls.plugin
@@ -0,0 +1,16 @@
+[Plugin]
+Builtin=true
+Copyright=Copyright © 2022 Christian Hergert
+Description=Language server integration for the Java programming language using jdtls
+Embedded=_gbp_jdtls_register_types
+Module=jdtls
+Name=Java Language Server
+X-Category=lsps
+X-Completion-Provider-Languages=java
+X-Symbol-Resolver-Languages=java
+X-Diagnostic-Provider-Languages=java
+X-Highlighter-Languages=java
+X-Hover-Provider-Languages=java
+X-Rename-Provider-Languages=java
+X-Formatter-Languages=java
+X-Code-Action-Languages=java
diff --git a/src/plugins/jdtls/meson.build b/src/plugins/jdtls/meson.build
new file mode 100644
index 000000000..468441513
--- /dev/null
+++ b/src/plugins/jdtls/meson.build
@@ -0,0 +1,24 @@
+if get_option('plugin_jdtls')
+
+plugins_sources += files([
+  'jdtls-plugin.c',
+  'gbp-jdtls-code-action-provider.c',
+  'gbp-jdtls-completion-provider.c',
+  'gbp-jdtls-diagnostic-provider.c',
+  'gbp-jdtls-formatter.c',
+  'gbp-jdtls-highlighter.c',
+  'gbp-jdtls-hover-provider.c',
+  'gbp-jdtls-rename-provider.c',
+  'gbp-jdtls-symbol-resolver.c',
+  'gbp-jdtls-service.c',
+])
+
+plugin_jdtls_resources = gnome.compile_resources(
+  'jdtls-resources',
+  'jdtls.gresource.xml',
+  c_name: 'gbp_jdtls',
+)
+
+plugins_sources += plugin_jdtls_resources
+
+endif


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