[gnome-builder/wip/gtk4-port] plugins/ts-language-server: port to C
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/gtk4-port] plugins/ts-language-server: port to C
- Date: Tue, 24 May 2022 20:57:03 +0000 (UTC)
commit d52f810d59788c1ee83f9c8c53b9160046b8a712
Author: Christian Hergert <chergert redhat com>
Date: Tue May 24 13:56:19 2022 -0700
plugins/ts-language-server: port to C
More work towards de-Pythonification in #1670.
.../gbp-tslsp-code-action-provider.c | 65 +++++++++++++++++
.../gbp-tslsp-code-action-provider.h | 31 ++++++++
.../gbp-tslsp-completion-provider.c | 75 ++++++++++++++++++++
.../gbp-tslsp-completion-provider.h | 31 ++++++++
.../gbp-tslsp-diagnostic-provider.c | 65 +++++++++++++++++
.../gbp-tslsp-diagnostic-provider.h | 31 ++++++++
.../ts-language-server/gbp-tslsp-formatter.c | 65 +++++++++++++++++
.../ts-language-server/gbp-tslsp-formatter.h | 31 ++++++++
.../ts-language-server/gbp-tslsp-highlighter.c | 65 +++++++++++++++++
.../ts-language-server/gbp-tslsp-highlighter.h | 31 ++++++++
.../ts-language-server/gbp-tslsp-hover-provider.c | 66 +++++++++++++++++
.../ts-language-server/gbp-tslsp-hover-provider.h | 31 ++++++++
.../ts-language-server/gbp-tslsp-rename-provider.c | 65 +++++++++++++++++
.../ts-language-server/gbp-tslsp-rename-provider.h | 31 ++++++++
src/plugins/ts-language-server/gbp-tslsp-service.c | 82 ++++++++++++++++++++++
src/plugins/ts-language-server/gbp-tslsp-service.h | 31 ++++++++
.../ts-language-server/gbp-tslsp-symbol-resolver.c | 65 +++++++++++++++++
.../ts-language-server/gbp-tslsp-symbol-resolver.h | 31 ++++++++
src/plugins/ts-language-server/meson.build | 27 ++++---
.../ts-language-server/ts-language-server-plugin.c | 68 ++++++++++++++++++
.../ts-language-server.gresource.xml | 6 ++
.../ts-language-server/ts-language-server.plugin | 11 ++-
.../ts_language_server_plugin.py | 80 ---------------------
23 files changed, 990 insertions(+), 94 deletions(-)
---
diff --git a/src/plugins/ts-language-server/gbp-tslsp-code-action-provider.c
b/src/plugins/ts-language-server/gbp-tslsp-code-action-provider.c
new file mode 100644
index 000000000..69f81cf16
--- /dev/null
+++ b/src/plugins/ts-language-server/gbp-tslsp-code-action-provider.c
@@ -0,0 +1,65 @@
+/* gbp-tslsp-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-tslsp-code-action-provider"
+
+#include "config.h"
+
+#include "gbp-tslsp-code-action-provider.h"
+#include "gbp-tslsp-service.h"
+
+struct _GbpTslspCodeActionProvider
+{
+ IdeLspCodeActionProvider parent_instance;
+};
+
+static void
+gbp_tslsp_code_action_provider_load (IdeCodeActionProvider *provider)
+{
+ g_autoptr(IdeLspServiceClass) klass = NULL;
+
+ IDE_ENTRY;
+
+ g_assert (GBP_IS_TSLSP_CODE_ACTION_PROVIDER (provider));
+
+ klass = g_type_class_ref (GBP_TYPE_TSLSP_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_tslsp_code_action_provider_load;
+}
+
+G_DEFINE_FINAL_TYPE_WITH_CODE (GbpTslspCodeActionProvider, gbp_tslsp_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_tslsp_code_action_provider_class_init (GbpTslspCodeActionProviderClass *klass)
+{
+}
+
+static void
+gbp_tslsp_code_action_provider_init (GbpTslspCodeActionProvider *self)
+{
+}
diff --git a/src/plugins/ts-language-server/gbp-tslsp-code-action-provider.h
b/src/plugins/ts-language-server/gbp-tslsp-code-action-provider.h
new file mode 100644
index 000000000..15b74e2ef
--- /dev/null
+++ b/src/plugins/ts-language-server/gbp-tslsp-code-action-provider.h
@@ -0,0 +1,31 @@
+/* gbp-tslsp-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_TSLSP_CODE_ACTION_PROVIDER (gbp_tslsp_code_action_provider_get_type())
+
+G_DECLARE_FINAL_TYPE (GbpTslspCodeActionProvider, gbp_tslsp_code_action_provider, GBP,
TSLSP_CODE_ACTION_PROVIDER, IdeLspCodeActionProvider)
+
+G_END_DECLS
diff --git a/src/plugins/ts-language-server/gbp-tslsp-completion-provider.c
b/src/plugins/ts-language-server/gbp-tslsp-completion-provider.c
new file mode 100644
index 000000000..e2112bca6
--- /dev/null
+++ b/src/plugins/ts-language-server/gbp-tslsp-completion-provider.c
@@ -0,0 +1,75 @@
+/* gbp-tslsp-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-tslsp-completion-provider"
+
+#include "config.h"
+
+#include "gbp-tslsp-completion-provider.h"
+#include "gbp-tslsp-service.h"
+
+struct _GbpTslspCompletionProvider
+{
+ IdeLspCompletionProvider parent_instance;
+};
+
+static void
+gbp_tslsp_completion_provider_load (IdeLspCompletionProvider *provider)
+{
+ g_autoptr(IdeLspServiceClass) klass = NULL;
+
+ IDE_ENTRY;
+
+ g_assert (GBP_IS_TSLSP_COMPLETION_PROVIDER (provider));
+
+ klass = g_type_class_ref (GBP_TYPE_TSLSP_SERVICE);
+ ide_lsp_service_class_bind_client (klass, IDE_OBJECT (provider));
+
+ IDE_EXIT;
+}
+
+static int
+gbp_tslsp_completion_provider_get_priority (GtkSourceCompletionProvider *provider,
+ GtkSourceCompletionContext *context)
+{
+ return -1000;
+}
+
+static void
+completion_provider_iface_init (GtkSourceCompletionProviderInterface *iface)
+{
+ iface->get_priority = gbp_tslsp_completion_provider_get_priority;
+}
+
+G_DEFINE_FINAL_TYPE_WITH_CODE (GbpTslspCompletionProvider, gbp_tslsp_completion_provider,
IDE_TYPE_LSP_COMPLETION_PROVIDER,
+ G_IMPLEMENT_INTERFACE (GTK_SOURCE_TYPE_COMPLETION_PROVIDER,
completion_provider_iface_init))
+
+static void
+gbp_tslsp_completion_provider_class_init (GbpTslspCompletionProviderClass *klass)
+{
+ IdeLspCompletionProviderClass *lsp_completion_provider_class = IDE_LSP_COMPLETION_PROVIDER_CLASS (klass);
+
+ lsp_completion_provider_class->load = gbp_tslsp_completion_provider_load;
+}
+
+static void
+gbp_tslsp_completion_provider_init (GbpTslspCompletionProvider *self)
+{
+}
diff --git a/src/plugins/ts-language-server/gbp-tslsp-completion-provider.h
b/src/plugins/ts-language-server/gbp-tslsp-completion-provider.h
new file mode 100644
index 000000000..66509351a
--- /dev/null
+++ b/src/plugins/ts-language-server/gbp-tslsp-completion-provider.h
@@ -0,0 +1,31 @@
+/* gbp-tslsp-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_TSLSP_COMPLETION_PROVIDER (gbp_tslsp_completion_provider_get_type())
+
+G_DECLARE_FINAL_TYPE (GbpTslspCompletionProvider, gbp_tslsp_completion_provider, GBP,
TSLSP_COMPLETION_PROVIDER, IdeLspCompletionProvider)
+
+G_END_DECLS
diff --git a/src/plugins/ts-language-server/gbp-tslsp-diagnostic-provider.c
b/src/plugins/ts-language-server/gbp-tslsp-diagnostic-provider.c
new file mode 100644
index 000000000..be3c40970
--- /dev/null
+++ b/src/plugins/ts-language-server/gbp-tslsp-diagnostic-provider.c
@@ -0,0 +1,65 @@
+/* gbp-tslsp-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-tslsp-diagnostic-provider"
+
+#include "config.h"
+
+#include "gbp-tslsp-diagnostic-provider.h"
+#include "gbp-tslsp-service.h"
+
+struct _GbpTslspDiagnosticProvider
+{
+ IdeLspDiagnosticProvider parent_instance;
+};
+
+static void
+gbp_tslsp_diagnostic_provider_load (IdeDiagnosticProvider *provider)
+{
+ g_autoptr(IdeLspServiceClass) klass = NULL;
+
+ IDE_ENTRY;
+
+ g_assert (GBP_IS_TSLSP_DIAGNOSTIC_PROVIDER (provider));
+
+ klass = g_type_class_ref (GBP_TYPE_TSLSP_SERVICE);
+ ide_lsp_service_class_bind_client (klass, IDE_OBJECT (provider));
+
+ IDE_EXIT;
+}
+
+static void
+diagnostic_provider_iface_init (IdeDiagnosticProviderInterface *iface)
+{
+ iface->load = gbp_tslsp_diagnostic_provider_load;
+}
+
+G_DEFINE_FINAL_TYPE_WITH_CODE (GbpTslspDiagnosticProvider, gbp_tslsp_diagnostic_provider,
IDE_TYPE_LSP_DIAGNOSTIC_PROVIDER,
+ G_IMPLEMENT_INTERFACE (IDE_TYPE_DIAGNOSTIC_PROVIDER,
diagnostic_provider_iface_init))
+
+static void
+gbp_tslsp_diagnostic_provider_class_init (GbpTslspDiagnosticProviderClass *klass)
+{
+}
+
+static void
+gbp_tslsp_diagnostic_provider_init (GbpTslspDiagnosticProvider *self)
+{
+}
diff --git a/src/plugins/ts-language-server/gbp-tslsp-diagnostic-provider.h
b/src/plugins/ts-language-server/gbp-tslsp-diagnostic-provider.h
new file mode 100644
index 000000000..1b425ef16
--- /dev/null
+++ b/src/plugins/ts-language-server/gbp-tslsp-diagnostic-provider.h
@@ -0,0 +1,31 @@
+/* gbp-tslsp-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_TSLSP_DIAGNOSTIC_PROVIDER (gbp_tslsp_diagnostic_provider_get_type())
+
+G_DECLARE_FINAL_TYPE (GbpTslspDiagnosticProvider, gbp_tslsp_diagnostic_provider, GBP,
TSLSP_DIAGNOSTIC_PROVIDER, IdeLspDiagnosticProvider)
+
+G_END_DECLS
diff --git a/src/plugins/ts-language-server/gbp-tslsp-formatter.c
b/src/plugins/ts-language-server/gbp-tslsp-formatter.c
new file mode 100644
index 000000000..8d62f8c4f
--- /dev/null
+++ b/src/plugins/ts-language-server/gbp-tslsp-formatter.c
@@ -0,0 +1,65 @@
+/* gbp-tslsp-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-tslsp-formatter"
+
+#include "config.h"
+
+#include "gbp-tslsp-formatter.h"
+#include "gbp-tslsp-service.h"
+
+struct _GbpTslspFormatter
+{
+ IdeLspFormatter parent_instance;
+};
+
+static void
+gbp_tslsp_formatter_load (IdeFormatter *provider)
+{
+ g_autoptr(IdeLspServiceClass) klass = NULL;
+
+ IDE_ENTRY;
+
+ g_assert (GBP_IS_TSLSP_FORMATTER (provider));
+
+ klass = g_type_class_ref (GBP_TYPE_TSLSP_SERVICE);
+ ide_lsp_service_class_bind_client (klass, IDE_OBJECT (provider));
+
+ IDE_EXIT;
+}
+
+static void
+formatter_iface_init (IdeFormatterInterface *iface)
+{
+ iface->load = gbp_tslsp_formatter_load;
+}
+
+G_DEFINE_FINAL_TYPE_WITH_CODE (GbpTslspFormatter, gbp_tslsp_formatter, IDE_TYPE_LSP_FORMATTER,
+ G_IMPLEMENT_INTERFACE (IDE_TYPE_FORMATTER, formatter_iface_init))
+
+static void
+gbp_tslsp_formatter_class_init (GbpTslspFormatterClass *klass)
+{
+}
+
+static void
+gbp_tslsp_formatter_init (GbpTslspFormatter *self)
+{
+}
diff --git a/src/plugins/ts-language-server/gbp-tslsp-formatter.h
b/src/plugins/ts-language-server/gbp-tslsp-formatter.h
new file mode 100644
index 000000000..9fe138cf3
--- /dev/null
+++ b/src/plugins/ts-language-server/gbp-tslsp-formatter.h
@@ -0,0 +1,31 @@
+/* gbp-tslsp-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_TSLSP_FORMATTER (gbp_tslsp_formatter_get_type())
+
+G_DECLARE_FINAL_TYPE (GbpTslspFormatter, gbp_tslsp_formatter, GBP, TSLSP_FORMATTER, IdeLspFormatter)
+
+G_END_DECLS
diff --git a/src/plugins/ts-language-server/gbp-tslsp-highlighter.c
b/src/plugins/ts-language-server/gbp-tslsp-highlighter.c
new file mode 100644
index 000000000..5095bb022
--- /dev/null
+++ b/src/plugins/ts-language-server/gbp-tslsp-highlighter.c
@@ -0,0 +1,65 @@
+/* gbp-tslsp-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-tslsp-highlighter"
+
+#include "config.h"
+
+#include "gbp-tslsp-highlighter.h"
+#include "gbp-tslsp-service.h"
+
+struct _GbpTslspHighlighter
+{
+ IdeLspHighlighter parent_instance;
+};
+
+static void
+gbp_tslsp_highlighter_load (IdeHighlighter *provider)
+{
+ g_autoptr(IdeLspServiceClass) klass = NULL;
+
+ IDE_ENTRY;
+
+ g_assert (GBP_IS_TSLSP_HIGHLIGHTER (provider));
+
+ klass = g_type_class_ref (GBP_TYPE_TSLSP_SERVICE);
+ ide_lsp_service_class_bind_client (klass, IDE_OBJECT (provider));
+
+ IDE_EXIT;
+}
+
+static void
+highlighter_iface_init (IdeHighlighterInterface *iface)
+{
+ iface->load = gbp_tslsp_highlighter_load;
+}
+
+G_DEFINE_FINAL_TYPE_WITH_CODE (GbpTslspHighlighter, gbp_tslsp_highlighter, IDE_TYPE_LSP_HIGHLIGHTER,
+ G_IMPLEMENT_INTERFACE (IDE_TYPE_HIGHLIGHTER, highlighter_iface_init))
+
+static void
+gbp_tslsp_highlighter_class_init (GbpTslspHighlighterClass *klass)
+{
+}
+
+static void
+gbp_tslsp_highlighter_init (GbpTslspHighlighter *self)
+{
+}
diff --git a/src/plugins/ts-language-server/gbp-tslsp-highlighter.h
b/src/plugins/ts-language-server/gbp-tslsp-highlighter.h
new file mode 100644
index 000000000..b0f7cf03d
--- /dev/null
+++ b/src/plugins/ts-language-server/gbp-tslsp-highlighter.h
@@ -0,0 +1,31 @@
+/* gbp-tslsp-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_TSLSP_HIGHLIGHTER (gbp_tslsp_highlighter_get_type())
+
+G_DECLARE_FINAL_TYPE (GbpTslspHighlighter, gbp_tslsp_highlighter, GBP, TSLSP_HIGHLIGHTER, IdeLspHighlighter)
+
+G_END_DECLS
diff --git a/src/plugins/ts-language-server/gbp-tslsp-hover-provider.c
b/src/plugins/ts-language-server/gbp-tslsp-hover-provider.c
new file mode 100644
index 000000000..68cf75168
--- /dev/null
+++ b/src/plugins/ts-language-server/gbp-tslsp-hover-provider.c
@@ -0,0 +1,66 @@
+/* gbp-tslsp-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-tslsp-hover-provider"
+
+#include "config.h"
+
+#include "gbp-tslsp-hover-provider.h"
+#include "gbp-tslsp-service.h"
+
+struct _GbpTslspHoverProvider
+{
+ IdeLspHoverProvider parent_instance;
+};
+
+static void
+gbp_tslsp_hover_provider_prepare (IdeLspHoverProvider *provider)
+{
+ g_autoptr(IdeLspServiceClass) klass = NULL;
+
+ IDE_ENTRY;
+
+ g_assert (GBP_IS_TSLSP_HOVER_PROVIDER (provider));
+
+ g_object_set (provider,
+ "category", "Typescript",
+ "priority", 200,
+ NULL);
+
+ klass = g_type_class_ref (GBP_TYPE_TSLSP_SERVICE);
+ ide_lsp_service_class_bind_client (klass, IDE_OBJECT (provider));
+
+ IDE_EXIT;
+}
+
+G_DEFINE_FINAL_TYPE (GbpTslspHoverProvider, gbp_tslsp_hover_provider, IDE_TYPE_LSP_HOVER_PROVIDER)
+
+static void
+gbp_tslsp_hover_provider_class_init (GbpTslspHoverProviderClass *klass)
+{
+ IdeLspHoverProviderClass *lsp_hover_provider_class = IDE_LSP_HOVER_PROVIDER_CLASS (klass);
+
+ lsp_hover_provider_class->prepare = gbp_tslsp_hover_provider_prepare;
+}
+
+static void
+gbp_tslsp_hover_provider_init (GbpTslspHoverProvider *self)
+{
+}
diff --git a/src/plugins/ts-language-server/gbp-tslsp-hover-provider.h
b/src/plugins/ts-language-server/gbp-tslsp-hover-provider.h
new file mode 100644
index 000000000..5540f0ada
--- /dev/null
+++ b/src/plugins/ts-language-server/gbp-tslsp-hover-provider.h
@@ -0,0 +1,31 @@
+/* gbp-tslsp-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_TSLSP_HOVER_PROVIDER (gbp_tslsp_hover_provider_get_type())
+
+G_DECLARE_FINAL_TYPE (GbpTslspHoverProvider, gbp_tslsp_hover_provider, GBP, TSLSP_HOVER_PROVIDER,
IdeLspHoverProvider)
+
+G_END_DECLS
diff --git a/src/plugins/ts-language-server/gbp-tslsp-rename-provider.c
b/src/plugins/ts-language-server/gbp-tslsp-rename-provider.c
new file mode 100644
index 000000000..92996f3bf
--- /dev/null
+++ b/src/plugins/ts-language-server/gbp-tslsp-rename-provider.c
@@ -0,0 +1,65 @@
+/* gbp-tslsp-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-tslsp-rename-provider"
+
+#include "config.h"
+
+#include "gbp-tslsp-rename-provider.h"
+#include "gbp-tslsp-service.h"
+
+struct _GbpTslspRenameProvider
+{
+ IdeLspRenameProvider parent_instance;
+};
+
+static void
+gbp_tslsp_rename_provider_load (IdeRenameProvider *provider)
+{
+ g_autoptr(IdeLspServiceClass) klass = NULL;
+
+ IDE_ENTRY;
+
+ g_assert (GBP_IS_TSLSP_RENAME_PROVIDER (provider));
+
+ klass = g_type_class_ref (GBP_TYPE_TSLSP_SERVICE);
+ ide_lsp_service_class_bind_client (klass, IDE_OBJECT (provider));
+
+ IDE_EXIT;
+}
+
+static void
+rename_provider_iface_init (IdeRenameProviderInterface *iface)
+{
+ iface->load = gbp_tslsp_rename_provider_load;
+}
+
+G_DEFINE_FINAL_TYPE_WITH_CODE (GbpTslspRenameProvider, gbp_tslsp_rename_provider,
IDE_TYPE_LSP_RENAME_PROVIDER,
+ G_IMPLEMENT_INTERFACE (IDE_TYPE_RENAME_PROVIDER, rename_provider_iface_init))
+
+static void
+gbp_tslsp_rename_provider_class_init (GbpTslspRenameProviderClass *klass)
+{
+}
+
+static void
+gbp_tslsp_rename_provider_init (GbpTslspRenameProvider *self)
+{
+}
diff --git a/src/plugins/ts-language-server/gbp-tslsp-rename-provider.h
b/src/plugins/ts-language-server/gbp-tslsp-rename-provider.h
new file mode 100644
index 000000000..57911bde0
--- /dev/null
+++ b/src/plugins/ts-language-server/gbp-tslsp-rename-provider.h
@@ -0,0 +1,31 @@
+/* gbp-tslsp-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_TSLSP_RENAME_PROVIDER (gbp_tslsp_rename_provider_get_type())
+
+G_DECLARE_FINAL_TYPE (GbpTslspRenameProvider, gbp_tslsp_rename_provider, GBP, TSLSP_RENAME_PROVIDER,
IdeLspRenameProvider)
+
+G_END_DECLS
diff --git a/src/plugins/ts-language-server/gbp-tslsp-service.c
b/src/plugins/ts-language-server/gbp-tslsp-service.c
new file mode 100644
index 000000000..cba1f9b78
--- /dev/null
+++ b/src/plugins/ts-language-server/gbp-tslsp-service.c
@@ -0,0 +1,82 @@
+/* gbp-tslsp-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-tslsp-service"
+
+#include "config.h"
+
+#include <jsonrpc-glib.h>
+
+#include <libide-threading.h>
+
+#include "gbp-tslsp-service.h"
+
+struct _GbpTslspService
+{
+ IdeLspService parent_instance;
+};
+
+G_DEFINE_FINAL_TYPE (GbpTslspService, gbp_tslsp_service, IDE_TYPE_LSP_SERVICE)
+
+static void
+gbp_tslsp_service_configure_client (IdeLspService *service,
+ IdeLspClient *client)
+{
+ IDE_ENTRY;
+
+ g_assert (GBP_IS_TSLSP_SERVICE (service));
+ g_assert (IDE_IS_LSP_CLIENT (client));
+
+ ide_lsp_client_add_language (client, "javascript");
+ ide_lsp_client_add_language (client, "typescript");
+
+ IDE_EXIT;
+}
+
+static void
+gbp_tslsp_service_configure_launcher (IdeLspService *service,
+ IdePipeline *pipeline,
+ IdeSubprocessLauncher *launcher)
+{
+ IDE_ENTRY;
+
+ g_assert (GBP_IS_TSLSP_SERVICE (service));
+ g_assert (IDE_IS_PIPELINE (pipeline));
+ g_assert (IDE_IS_SUBPROCESS_LAUNCHER (launcher));
+
+ ide_subprocess_launcher_push_argv (launcher, "--stdio");
+
+ IDE_EXIT;
+}
+
+static void
+gbp_tslsp_service_class_init (GbpTslspServiceClass *klass)
+{
+ IdeLspServiceClass *lsp_service_class = IDE_LSP_SERVICE_CLASS (klass);
+
+ lsp_service_class->configure_client = gbp_tslsp_service_configure_client;
+ lsp_service_class->configure_launcher= gbp_tslsp_service_configure_launcher;
+}
+
+static void
+gbp_tslsp_service_init (GbpTslspService *self)
+{
+ ide_lsp_service_set_program (IDE_LSP_SERVICE (self), "typescript-language-server");
+}
diff --git a/src/plugins/ts-language-server/gbp-tslsp-service.h
b/src/plugins/ts-language-server/gbp-tslsp-service.h
new file mode 100644
index 000000000..ebb1ac565
--- /dev/null
+++ b/src/plugins/ts-language-server/gbp-tslsp-service.h
@@ -0,0 +1,31 @@
+/* gbp-tslsp-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_TSLSP_SERVICE (gbp_tslsp_service_get_type())
+
+G_DECLARE_FINAL_TYPE (GbpTslspService, gbp_tslsp_service, GBP, TSLSP_SERVICE, IdeLspService)
+
+G_END_DECLS
diff --git a/src/plugins/ts-language-server/gbp-tslsp-symbol-resolver.c
b/src/plugins/ts-language-server/gbp-tslsp-symbol-resolver.c
new file mode 100644
index 000000000..7cb22d39e
--- /dev/null
+++ b/src/plugins/ts-language-server/gbp-tslsp-symbol-resolver.c
@@ -0,0 +1,65 @@
+/* gbp-tslsp-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-tslsp-symbol-resolver"
+
+#include "config.h"
+
+#include "gbp-tslsp-symbol-resolver.h"
+#include "gbp-tslsp-service.h"
+
+struct _GbpTslspSymbolResolver
+{
+ IdeLspSymbolResolver parent_instance;
+};
+
+static void
+gbp_tslsp_symbol_provider_load (IdeSymbolResolver *provider)
+{
+ g_autoptr(IdeLspServiceClass) klass = NULL;
+
+ IDE_ENTRY;
+
+ g_assert (GBP_IS_TSLSP_SYMBOL_RESOLVER (provider));
+
+ klass = g_type_class_ref (GBP_TYPE_TSLSP_SERVICE);
+ ide_lsp_service_class_bind_client (klass, IDE_OBJECT (provider));
+
+ IDE_EXIT;
+}
+
+static void
+symbol_provider_iface_init (IdeSymbolResolverInterface *iface)
+{
+ iface->load = gbp_tslsp_symbol_provider_load;
+}
+
+G_DEFINE_FINAL_TYPE_WITH_CODE (GbpTslspSymbolResolver, gbp_tslsp_symbol_provider,
IDE_TYPE_LSP_SYMBOL_RESOLVER,
+ G_IMPLEMENT_INTERFACE (IDE_TYPE_SYMBOL_RESOLVER, symbol_provider_iface_init))
+
+static void
+gbp_tslsp_symbol_provider_class_init (GbpTslspSymbolResolverClass *klass)
+{
+}
+
+static void
+gbp_tslsp_symbol_provider_init (GbpTslspSymbolResolver *self)
+{
+}
diff --git a/src/plugins/ts-language-server/gbp-tslsp-symbol-resolver.h
b/src/plugins/ts-language-server/gbp-tslsp-symbol-resolver.h
new file mode 100644
index 000000000..f53fa9a94
--- /dev/null
+++ b/src/plugins/ts-language-server/gbp-tslsp-symbol-resolver.h
@@ -0,0 +1,31 @@
+/* gbp-tslsp-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_TSLSP_SYMBOL_RESOLVER (gbp_tslsp_symbol_provider_get_type())
+
+G_DECLARE_FINAL_TYPE (GbpTslspSymbolResolver, gbp_tslsp_symbol_provider, GBP, TSLSP_SYMBOL_RESOLVER,
IdeLspSymbolResolver)
+
+G_END_DECLS
diff --git a/src/plugins/ts-language-server/meson.build b/src/plugins/ts-language-server/meson.build
index 11436b69f..c6bc9ad47 100644
--- a/src/plugins/ts-language-server/meson.build
+++ b/src/plugins/ts-language-server/meson.build
@@ -1,13 +1,24 @@
if get_option('plugin_ts_language_server')
-install_data('ts_language_server_plugin.py', install_dir: plugindir)
-
-configure_file(
- input: 'ts-language-server.plugin',
- output: 'ts-language-server.plugin',
- configuration: config_h,
- install: true,
- install_dir: plugindir,
+plugins_sources += files([
+ 'ts-language-server-plugin.c',
+ 'gbp-tslsp-code-action-provider.c',
+ 'gbp-tslsp-completion-provider.c',
+ 'gbp-tslsp-diagnostic-provider.c',
+ 'gbp-tslsp-formatter.c',
+ 'gbp-tslsp-highlighter.c',
+ 'gbp-tslsp-hover-provider.c',
+ 'gbp-tslsp-rename-provider.c',
+ 'gbp-tslsp-symbol-resolver.c',
+ 'gbp-tslsp-service.c',
+])
+
+plugin_tslsp_resources = gnome.compile_resources(
+ 'ts-language-server-resources',
+ 'ts-language-server.gresource.xml',
+ c_name: 'gbp_tslsp',
)
+plugins_sources += plugin_tslsp_resources
+
endif
diff --git a/src/plugins/ts-language-server/ts-language-server-plugin.c
b/src/plugins/ts-language-server/ts-language-server-plugin.c
new file mode 100644
index 000000000..c660fb610
--- /dev/null
+++ b/src/plugins/ts-language-server/ts-language-server-plugin.c
@@ -0,0 +1,68 @@
+/* ts-language-server-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 "ts-language-server-plugin"
+
+#include "config.h"
+
+#include <libpeas/peas.h>
+
+#include <libide-code.h>
+#include <libide-foundry.h>
+#include <libide-lsp.h>
+
+#include "gbp-tslsp-service.h"
+#include "gbp-tslsp-completion-provider.h"
+#include "gbp-tslsp-diagnostic-provider.h"
+#include "gbp-tslsp-symbol-resolver.h"
+#include "gbp-tslsp-highlighter.h"
+#include "gbp-tslsp-formatter.h"
+#include "gbp-tslsp-rename-provider.h"
+#include "gbp-tslsp-hover-provider.h"
+#include "gbp-tslsp-code-action-provider.h"
+
+_IDE_EXTERN void
+_gbp_tslsp_register_types (PeasObjectModule *module)
+{
+ peas_object_module_register_extension_type (module,
+ IDE_TYPE_DIAGNOSTIC_PROVIDER,
+ GBP_TYPE_TSLSP_DIAGNOSTIC_PROVIDER);
+ peas_object_module_register_extension_type (module,
+ GTK_SOURCE_TYPE_COMPLETION_PROVIDER,
+ GBP_TYPE_TSLSP_COMPLETION_PROVIDER);
+ peas_object_module_register_extension_type (module,
+ IDE_TYPE_SYMBOL_RESOLVER,
+ GBP_TYPE_TSLSP_SYMBOL_RESOLVER);
+ peas_object_module_register_extension_type (module,
+ IDE_TYPE_HIGHLIGHTER,
+ GBP_TYPE_TSLSP_HIGHLIGHTER);
+ peas_object_module_register_extension_type (module,
+ IDE_TYPE_FORMATTER,
+ GBP_TYPE_TSLSP_FORMATTER);
+ peas_object_module_register_extension_type (module,
+ GTK_SOURCE_TYPE_HOVER_PROVIDER,
+ GBP_TYPE_TSLSP_HOVER_PROVIDER);
+ peas_object_module_register_extension_type (module,
+ IDE_TYPE_RENAME_PROVIDER,
+ GBP_TYPE_TSLSP_RENAME_PROVIDER);
+ peas_object_module_register_extension_type (module,
+ IDE_TYPE_CODE_ACTION_PROVIDER,
+ GBP_TYPE_TSLSP_CODE_ACTION_PROVIDER);
+}
diff --git a/src/plugins/ts-language-server/ts-language-server.gresource.xml
b/src/plugins/ts-language-server/ts-language-server.gresource.xml
new file mode 100644
index 000000000..9ced5654f
--- /dev/null
+++ b/src/plugins/ts-language-server/ts-language-server.gresource.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+ <gresource prefix="/plugins/ts-language-server">
+ <file>ts-language-server.plugin</file>
+ </gresource>
+</gresources>
diff --git a/src/plugins/ts-language-server/ts-language-server.plugin
b/src/plugins/ts-language-server/ts-language-server.plugin
index f82f0609d..25ac702d6 100644
--- a/src/plugins/ts-language-server/ts-language-server.plugin
+++ b/src/plugins/ts-language-server/ts-language-server.plugin
@@ -1,11 +1,10 @@
[Plugin]
Builtin=true
-Copyright=Copyright © 2021 Georg Vienna
-Description=Provides LSP integration for Typescript/Javascript
-Loader=python3
-Module=ts_language_server_plugin
-Name=Typescript Language Server Plugin
-X-Builder-ABI=@PACKAGE_ABI@
+Copyright=Copyright © 2021 Georg Vienna, Copyright © 2022 Christian Hergert
+Description=Provides language server integration for Typescript and Javascript
+Embedded=_gbp_tslsp_register_types
+Module=ts-language-server
+Name=Typescript Language Server
X-Category=lsps
X-Code-Action-Languages=js,jsx,typescript,typescript-jsx
X-Completion-Provider-Languages=js,jsx,typescript,typescript-jsx
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]