[gnome-builder] plugins/python-lsp-server: add support for pylsp



commit 4fdb7fa09260fac2b4f46783c9ea3b418a7ed8f0
Author: Christian Hergert <chergert redhat com>
Date:   Tue Sep 27 15:45:01 2022 -0700

    plugins/python-lsp-server: add support for pylsp
    
    This integrates the pip "python-lsp-server" project which is maintained
    as part of the Spyder IDE.
    
      https://github.com/python-lsp/python-lsp-server
    
    It appears to be better maintained especially for newer Python releases.

 build-aux/flatpak/python3-python-lsp-server.json   | 149 +++++++++++++++++++++
 meson_options.txt                                  |   1 +
 org.gnome.Builder.Devel.json                       |   1 +
 src/plugins/meson.build                            |   2 +
 .../gbp-pylsp-code-action-provider.c               |  65 +++++++++
 .../gbp-pylsp-code-action-provider.h               |  31 +++++
 .../gbp-pylsp-completion-provider.c                |  61 +++++++++
 .../gbp-pylsp-completion-provider.h                |  31 +++++
 .../gbp-pylsp-diagnostic-provider.c                |  65 +++++++++
 .../gbp-pylsp-diagnostic-provider.h                |  31 +++++
 .../python-lsp-server/gbp-pylsp-formatter.c        |  65 +++++++++
 .../python-lsp-server/gbp-pylsp-formatter.h        |  31 +++++
 .../python-lsp-server/gbp-pylsp-highlighter.c      |  65 +++++++++
 .../python-lsp-server/gbp-pylsp-highlighter.h      |  31 +++++
 .../python-lsp-server/gbp-pylsp-hover-provider.c   |  66 +++++++++
 .../python-lsp-server/gbp-pylsp-hover-provider.h   |  31 +++++
 .../python-lsp-server/gbp-pylsp-rename-provider.c  |  65 +++++++++
 .../python-lsp-server/gbp-pylsp-rename-provider.h  |  31 +++++
 src/plugins/python-lsp-server/gbp-pylsp-service.c  |  72 ++++++++++
 src/plugins/python-lsp-server/gbp-pylsp-service.h  |  31 +++++
 .../python-lsp-server/gbp-pylsp-symbol-resolver.c  |  65 +++++++++
 .../python-lsp-server/gbp-pylsp-symbol-resolver.h  |  31 +++++
 src/plugins/python-lsp-server/meson.build          |  24 ++++
 .../pylsp-language-server-plugin.c                 |  68 ++++++++++
 .../pylsp-language-server.gresource.xml            |   6 +
 .../python-lsp-server/pylsp-language-server.plugin |  16 +++
 26 files changed, 1135 insertions(+)
---
diff --git a/build-aux/flatpak/python3-python-lsp-server.json 
b/build-aux/flatpak/python3-python-lsp-server.json
new file mode 100644
index 000000000..78ce2bf1d
--- /dev/null
+++ b/build-aux/flatpak/python3-python-lsp-server.json
@@ -0,0 +1,149 @@
+{
+    "name": "python3-python-lsp-server",
+    "buildsystem": "simple",
+    "build-commands": [
+        "pip3 install --verbose --exists-action=i --no-index --find-links=\"file://${PWD}\" 
--prefix=${FLATPAK_DEST} \"python-lsp-server[all]\" --no-build-isolation"
+    ],
+    "sources": [
+        {
+            "type": "file",
+            "url": 
"https://files.pythonhosted.org/packages/68/48/7f3de2f4f94f0b18afe5bc1b587a23b4f9a173909db4eff9cc7d92b8d3cc/astroid-2.12.10-py3-none-any.whl";,
+            "sha256": "997e0c735df60d4a4caff27080a3afc51f9bdd693d3572a4a0b7090b645c36c5"
+        },
+        {
+            "type": "file",
+            "url": 
"https://files.pythonhosted.org/packages/39/3a/cd60ecce0d9737efefc06a074ae280a5d0e904d697fe59b414bf8ab5c472/autopep8-1.6.0-py2.py3-none-any.whl";,
+            "sha256": "ed77137193bbac52d029a52c59bec1b0629b5a186c495f1eb21b126ac466083f"
+        },
+        {
+            "type": "file",
+            "url": 
"https://files.pythonhosted.org/packages/12/ff/3b1a8f5d59600393506c64fa14d13afdfe6fe79ed65a18d64026fe9f8356/dill-0.3.5.1-py2.py3-none-any.whl";,
+            "sha256": "33501d03270bbe410c72639b350e941882a8b0fd55357580fbc873fba0c59302"
+        },
+        {
+            "type": "file",
+            "url": 
"https://files.pythonhosted.org/packages/34/39/cde2c8a227abb4f9ce62fe55586b920f438f1d2903a1a22514d0b982c333/flake8-4.0.1-py2.py3-none-any.whl";,
+            "sha256": "479b1304f72536a55948cb40a32dce8bb0ffe3501e26eaf292c7e60eb5e0428d"
+        },
+        {
+            "type": "file",
+            "url": 
"https://files.pythonhosted.org/packages/b8/5b/f18e227df38b94b4ee30d2502fd531bebac23946a2497e5595067a561274/isort-5.10.1-py3-none-any.whl";,
+            "sha256": "6f62d78e2f89b4500b080fe3a81690850cd254227f27f75c3a0c491a1f351ba7"
+        },
+        {
+            "type": "file",
+            "url": 
"https://files.pythonhosted.org/packages/b3/0e/836f12ec50075161e365131f13f5758451645af75c2becf61c6351ecec39/jedi-0.18.1-py2.py3-none-any.whl";,
+            "sha256": "637c9635fcf47945ceb91cd7f320234a7be540ded6f3e99a50cb6febdfd1ba8d"
+        },
+        {
+            "type": "file",
+            "url": 
"https://files.pythonhosted.org/packages/75/93/3fc1cc28f71dd10b87a53b9d809602d7730e84cc4705a062def286232a9c/lazy-object-proxy-1.7.1.tar.gz";,
+            "sha256": "d609c75b986def706743cdebe5e47553f4a5a1da9c5ff66d76013ef396b5a8a4"
+        },
+        {
+            "type": "file",
+            "url": 
"https://files.pythonhosted.org/packages/87/89/479dc97e18549e21354893e4ee4ef36db1d237534982482c3681ee6e7b57/mccabe-0.6.1-py2.py3-none-any.whl";,
+            "sha256": "ab8a6258860da4b6677da4bd2fe5dc2c659cff31b3ee4f7f5d64e79735b80d42"
+        },
+        {
+            "type": "file",
+            "url": 
"https://files.pythonhosted.org/packages/05/8e/8de486cbd03baba4deef4142bd643a3e7bbe954a784dc1bb17142572d127/packaging-21.3-py3-none-any.whl";,
+            "sha256": "ef103e05f519cdc783ae24ea4e2e0f508a9c99b2d4969652eed6a2e1ea5bd522"
+        },
+        {
+            "type": "file",
+            "url": 
"https://files.pythonhosted.org/packages/05/63/8011bd08a4111858f79d2b09aad86638490d62fbf881c44e434a6dfca87b/parso-0.8.3-py2.py3-none-any.whl";,
+            "sha256": "c001d4636cd3aecdaf33cbb40aebb59b094be2a74c556778ef5576c175e19e75"
+        },
+        {
+            "type": "file",
+            "url": 
"https://files.pythonhosted.org/packages/ed/22/967181c94c3a4063fe64e15331b4cb366bdd7dfbf46fcb8ad89650026fec/platformdirs-2.5.2-py3-none-any.whl";,
+            "sha256": "027d8e83a2d7de06bbac4e5ef7e023c02b863d7ea5d079477e722bb41ab25788"
+        },
+        {
+            "type": "file",
+            "url": 
"https://files.pythonhosted.org/packages/9e/01/f38e2ff29715251cf25532b9082a1589ab7e4f571ced434f98d0139336dc/pluggy-1.0.0-py2.py3-none-any.whl";,
+            "sha256": "74134bbf457f031a36d68416e1509f34bd5ccc019f0bcc952c7b909d06b37bd3"
+        },
+        {
+            "type": "file",
+            "url": 
"https://files.pythonhosted.org/packages/15/94/bc43a2efb7b8615e38acde2b6624cae8c9ec86faf718ff5676c5179a7714/pycodestyle-2.8.0-py2.py3-none-any.whl";,
+            "sha256": "720f8b39dde8b293825e7ff02c475f3077124006db4f440dcbc9a20b76548a20"
+        },
+        {
+            "type": "file",
+            "url": 
"https://files.pythonhosted.org/packages/87/67/4df10786068766000518c6ad9c4a614e77585a12ab8f0654c776757ac9dc/pydocstyle-6.1.1-py3-none-any.whl";,
+            "sha256": "6987826d6775056839940041beef5c08cc7e3d71d63149b48e36727f70144dc4"
+        },
+        {
+            "type": "file",
+            "url": 
"https://files.pythonhosted.org/packages/43/fb/38848eb494af7df9aeb2d7673ace8b213313eb7e391691a79dbaeb6a838f/pyflakes-2.4.0-py2.py3-none-any.whl";,
+            "sha256": "3bb3a3f256f4b7968c9c788781e4ff07dce46bdf12339dcda61053375426ee2e"
+        },
+        {
+            "type": "file",
+            "url": 
"https://files.pythonhosted.org/packages/88/f8/0c3997743400f998fb10e17b5b4c8d1712d1548173140477513ba2f52070/pylint-2.15.3-py3-none-any.whl";,
+            "sha256": "7f6aad1d8d50807f7bc64f89ac75256a9baf8e6ed491cc9bc65592bc3f462cf1"
+        },
+        {
+            "type": "file",
+            "url": 
"https://files.pythonhosted.org/packages/6c/10/a7d0fa5baea8fe7b50f448ab742f26f52b80bfca85ac2be9d35cdd9a3246/pyparsing-3.0.9-py3-none-any.whl";,
+            "sha256": "5026bae9a10eeaefb61dab2f09052b9f4307d44aee4eda64b309723d8d206bbc"
+        },
+        {
+            "type": "file",
+            "url": 
"https://files.pythonhosted.org/packages/06/ee/754bfd5f6bfe7162c10d3ecb0aeef6f882f91d3231596c83f761a75efd0b/python_lsp_jsonrpc-1.0.0-py3-none-any.whl";,
+            "sha256": "079b143be64b0a378bdb21dff5e28a8c1393fe7e8a654ef068322d754e545fc7"
+        },
+        {
+            "type": "file",
+            "url": 
"https://files.pythonhosted.org/packages/b1/5a/ad7c922b5e0018b0e832d7616023751ecf35a6eaa2919ff996e95ade6e7b/python_lsp_server-1.5.0-py3-none-any.whl";,
+            "sha256": "77aac9861b0e23cafb251f116448157e6c45957e625097ed4846891281cffc18"
+        },
+        {
+            "type": "file",
+            "url": 
"https://files.pythonhosted.org/packages/26/15/e21a7c063c29c0b782be090df589b25fdc62ea3b5e5687a94a217851944e/pytoolconfig-1.2.2-py3-none-any.whl";,
+            "sha256": "825d97b052e58b609c2684b04efeb543075588d33a4916a6dc2ae39676458c7d"
+        },
+        {
+            "type": "file",
+            "url": 
"https://files.pythonhosted.org/packages/08/81/205ef66c8a129a7b87cbdadf59f2dbc2bbad24c6073d9e393fb0e2aa7d78/rope-1.3.0-py3-none-any.whl";,
+            "sha256": "f0c82bd7167c2926339c6f0d9ecf7c93d6866cbe380c78639fa1bc4ac037c097"
+        },
+        {
+            "type": "file",
+            "url": 
"https://files.pythonhosted.org/packages/ed/dc/c02e01294f7265e63a7315fe086dd1df7dacb9f840a804da846b96d01b96/snowballstemmer-2.2.0-py2.py3-none-any.whl";,
+            "sha256": "c8e1716e83cc398ae16824e5572ae04e0d9fc2c6b985fb0f900f5f0c96ecba1a"
+        },
+        {
+            "type": "file",
+            "url": 
"https://files.pythonhosted.org/packages/44/6f/7120676b6d73228c96e17f1f794d8ab046fc910d781c8d151120c3f1569e/toml-0.10.2-py2.py3-none-any.whl";,
+            "sha256": "806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"
+        },
+        {
+            "type": "file",
+            "url": 
"https://files.pythonhosted.org/packages/18/31/2a87f292f752d39c6c207f9e44137e3e1d4250da880a9fbc0bbf630138e0/tomlkit-0.11.4-py3-none-any.whl";,
+            "sha256": "25d4e2e446c453be6360c67ddfb88838cfc42026322770ba13d1fbd403a93a5c"
+        },
+        {
+            "type": "file",
+            "url": 
"https://files.pythonhosted.org/packages/6e/4a/03ddad85a10dd52e209993a14afa0cb0dc5c348e4647329f1c53856ad9e6/ujson-5.5.0.tar.gz";,
+            "sha256": "b25077a971c7da47bd6846a912a747f6963776d90720c88603b1b55d81790780"
+        },
+        {
+            "type": "file",
+            "url": 
"https://files.pythonhosted.org/packages/fe/31/bf06fa31436e8118447bed0a428a1279d1164ebdc2d8866666033ab03ca8/whatthepatch-1.0.2-py2.py3-none-any.whl";,
+            "sha256": "6d920d6c328eda006f12ec05bc9eadb405957b18460520db195f9a21eb3336e1"
+        },
+        {
+            "type": "file",
+            "url": 
"https://files.pythonhosted.org/packages/11/eb/e06e77394d6cf09977d92bff310cb0392930c08a338f99af6066a5a98f92/wrapt-1.14.1.tar.gz";,
+            "sha256": "380a85cf89e0e69b7cfbe2ea9f765f004ff419f34194018a6827ac0e3edfed4d"
+        },
+        {
+            "type": "file",
+            "url": 
"https://files.pythonhosted.org/packages/47/88/843c2e68f18a5879b4fbf37cb99fbabe1ffc4343b2e63191c8462235c008/yapf-0.32.0-py2.py3-none-any.whl";,
+            "sha256": "8fea849025584e486fd06d6ba2bed717f396080fd3cc236ba10cb97c4c51cf32"
+        }
+    ]
+}
\ No newline at end of file
diff --git a/meson_options.txt b/meson_options.txt
index 765e1a767..7e16ee4cb 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -63,6 +63,7 @@ option('plugin_npm', type: 'boolean')
 option('plugin_phpize', type: 'boolean')
 option('plugin_podman', type: 'boolean')
 option('plugin_pygi', type: 'boolean')
+option('plugin_python_lsp_server', type: 'boolean')
 option('plugin_qemu', type: 'boolean')
 option('plugin_quick_highlight', type: 'boolean')
 option('plugin_retab', type: 'boolean')
diff --git a/org.gnome.Builder.Devel.json b/org.gnome.Builder.Devel.json
index 01b8e628e..12c01a24a 100644
--- a/org.gnome.Builder.Devel.json
+++ b/org.gnome.Builder.Devel.json
@@ -88,6 +88,7 @@
     ],
     "modules" : [
         "build-aux/flatpak/python-deps.json",
+        "build-aux/flatpak/python3-python-lsp-server.json",
         {
             "name" : "gperftools",
             "cleanup" : [
diff --git a/src/plugins/meson.build b/src/plugins/meson.build
index 2bcd697e6..fc5715811 100644
--- a/src/plugins/meson.build
+++ b/src/plugins/meson.build
@@ -104,6 +104,7 @@ subdir('podman')
 subdir('project-tree')
 subdir('projectui')
 subdir('pygi')
+subdir('python-lsp-server')
 subdir('qemu')
 subdir('quick-highlight')
 subdir('recent')
@@ -218,6 +219,7 @@ status += [
   'intelephense ................... (PHP) : @0@'.format(get_option('plugin_intelephense')),
   'jdtls ......................... (Java) : @0@'.format(get_option('plugin_jdtls')),
   'jedi-language-server ........ (Python) : @0@ **'.format(get_option('plugin_jedi_language_server')),
+  'python-lsp-server ........... (Python) : @0@'.format(get_option('plugin_python_lsp_server')),
   '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/python-lsp-server/gbp-pylsp-code-action-provider.c 
b/src/plugins/python-lsp-server/gbp-pylsp-code-action-provider.c
new file mode 100644
index 000000000..c2330ffd6
--- /dev/null
+++ b/src/plugins/python-lsp-server/gbp-pylsp-code-action-provider.c
@@ -0,0 +1,65 @@
+/* gbp-pylsp-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-pylsp-code-action-provider"
+
+#include "config.h"
+
+#include "gbp-pylsp-code-action-provider.h"
+#include "gbp-pylsp-service.h"
+
+struct _GbpPylspCodeActionProvider
+{
+  IdeLspCodeActionProvider parent_instance;
+};
+
+static void
+gbp_pylsp_code_action_provider_load (IdeCodeActionProvider *provider)
+{
+  g_autoptr(IdeLspServiceClass) klass = NULL;
+
+  IDE_ENTRY;
+
+  g_assert (GBP_IS_PYLSP_CODE_ACTION_PROVIDER (provider));
+
+  klass = g_type_class_ref (GBP_TYPE_PYLSP_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_pylsp_code_action_provider_load;
+}
+
+G_DEFINE_FINAL_TYPE_WITH_CODE (GbpPylspCodeActionProvider, gbp_pylsp_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_pylsp_code_action_provider_class_init (GbpPylspCodeActionProviderClass *klass)
+{
+}
+
+static void
+gbp_pylsp_code_action_provider_init (GbpPylspCodeActionProvider *self)
+{
+}
diff --git a/src/plugins/python-lsp-server/gbp-pylsp-code-action-provider.h 
b/src/plugins/python-lsp-server/gbp-pylsp-code-action-provider.h
new file mode 100644
index 000000000..e92d13ebc
--- /dev/null
+++ b/src/plugins/python-lsp-server/gbp-pylsp-code-action-provider.h
@@ -0,0 +1,31 @@
+/* gbp-pylsp-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_PYLSP_CODE_ACTION_PROVIDER (gbp_pylsp_code_action_provider_get_type())
+
+G_DECLARE_FINAL_TYPE (GbpPylspCodeActionProvider, gbp_pylsp_code_action_provider, GBP, 
PYLSP_CODE_ACTION_PROVIDER, IdeLspCodeActionProvider)
+
+G_END_DECLS
diff --git a/src/plugins/python-lsp-server/gbp-pylsp-completion-provider.c 
b/src/plugins/python-lsp-server/gbp-pylsp-completion-provider.c
new file mode 100644
index 000000000..0060fc503
--- /dev/null
+++ b/src/plugins/python-lsp-server/gbp-pylsp-completion-provider.c
@@ -0,0 +1,61 @@
+/* gbp-pylsp-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-pylsp-completion-provider"
+
+#include "config.h"
+
+#include "gbp-pylsp-completion-provider.h"
+#include "gbp-pylsp-service.h"
+
+struct _GbpPylspCompletionProvider
+{
+  IdeLspCompletionProvider parent_instance;
+};
+
+static void
+gbp_pylsp_completion_provider_load (IdeLspCompletionProvider *provider)
+{
+  g_autoptr(IdeLspServiceClass) klass = NULL;
+
+  IDE_ENTRY;
+
+  g_assert (GBP_IS_PYLSP_COMPLETION_PROVIDER (provider));
+
+  klass = g_type_class_ref (GBP_TYPE_PYLSP_SERVICE);
+  ide_lsp_service_class_bind_client (klass, IDE_OBJECT (provider));
+
+  IDE_EXIT;
+}
+
+G_DEFINE_FINAL_TYPE (GbpPylspCompletionProvider, gbp_pylsp_completion_provider, 
IDE_TYPE_LSP_COMPLETION_PROVIDER)
+
+static void
+gbp_pylsp_completion_provider_class_init (GbpPylspCompletionProviderClass *klass)
+{
+  IdeLspCompletionProviderClass *lsp_completion_provider_class = IDE_LSP_COMPLETION_PROVIDER_CLASS (klass);
+
+  lsp_completion_provider_class->load = gbp_pylsp_completion_provider_load;
+}
+
+static void
+gbp_pylsp_completion_provider_init (GbpPylspCompletionProvider *self)
+{
+}
diff --git a/src/plugins/python-lsp-server/gbp-pylsp-completion-provider.h 
b/src/plugins/python-lsp-server/gbp-pylsp-completion-provider.h
new file mode 100644
index 000000000..19d3460e1
--- /dev/null
+++ b/src/plugins/python-lsp-server/gbp-pylsp-completion-provider.h
@@ -0,0 +1,31 @@
+/* gbp-pylsp-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_PYLSP_COMPLETION_PROVIDER (gbp_pylsp_completion_provider_get_type())
+
+G_DECLARE_FINAL_TYPE (GbpPylspCompletionProvider, gbp_pylsp_completion_provider, GBP, 
PYLSP_COMPLETION_PROVIDER, IdeLspCompletionProvider)
+
+G_END_DECLS
diff --git a/src/plugins/python-lsp-server/gbp-pylsp-diagnostic-provider.c 
b/src/plugins/python-lsp-server/gbp-pylsp-diagnostic-provider.c
new file mode 100644
index 000000000..910b3c039
--- /dev/null
+++ b/src/plugins/python-lsp-server/gbp-pylsp-diagnostic-provider.c
@@ -0,0 +1,65 @@
+/* gbp-pylsp-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-pylsp-diagnostic-provider"
+
+#include "config.h"
+
+#include "gbp-pylsp-diagnostic-provider.h"
+#include "gbp-pylsp-service.h"
+
+struct _GbpPylspDiagnosticProvider
+{
+  IdeLspDiagnosticProvider parent_instance;
+};
+
+static void
+gbp_pylsp_diagnostic_provider_load (IdeDiagnosticProvider *provider)
+{
+  g_autoptr(IdeLspServiceClass) klass = NULL;
+
+  IDE_ENTRY;
+
+  g_assert (GBP_IS_PYLSP_DIAGNOSTIC_PROVIDER (provider));
+
+  klass = g_type_class_ref (GBP_TYPE_PYLSP_SERVICE);
+  ide_lsp_service_class_bind_client (klass, IDE_OBJECT (provider));
+
+  IDE_EXIT;
+}
+
+static void
+diagnostic_provider_iface_init (IdeDiagnosticProviderInterface *iface)
+{
+  iface->load = gbp_pylsp_diagnostic_provider_load;
+}
+
+G_DEFINE_FINAL_TYPE_WITH_CODE (GbpPylspDiagnosticProvider, gbp_pylsp_diagnostic_provider, 
IDE_TYPE_LSP_DIAGNOSTIC_PROVIDER,
+                               G_IMPLEMENT_INTERFACE (IDE_TYPE_DIAGNOSTIC_PROVIDER, 
diagnostic_provider_iface_init))
+
+static void
+gbp_pylsp_diagnostic_provider_class_init (GbpPylspDiagnosticProviderClass *klass)
+{
+}
+
+static void
+gbp_pylsp_diagnostic_provider_init (GbpPylspDiagnosticProvider *self)
+{
+}
diff --git a/src/plugins/python-lsp-server/gbp-pylsp-diagnostic-provider.h 
b/src/plugins/python-lsp-server/gbp-pylsp-diagnostic-provider.h
new file mode 100644
index 000000000..42f95545b
--- /dev/null
+++ b/src/plugins/python-lsp-server/gbp-pylsp-diagnostic-provider.h
@@ -0,0 +1,31 @@
+/* gbp-pylsp-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_PYLSP_DIAGNOSTIC_PROVIDER (gbp_pylsp_diagnostic_provider_get_type())
+
+G_DECLARE_FINAL_TYPE (GbpPylspDiagnosticProvider, gbp_pylsp_diagnostic_provider, GBP, 
PYLSP_DIAGNOSTIC_PROVIDER, IdeLspDiagnosticProvider)
+
+G_END_DECLS
diff --git a/src/plugins/python-lsp-server/gbp-pylsp-formatter.c 
b/src/plugins/python-lsp-server/gbp-pylsp-formatter.c
new file mode 100644
index 000000000..4dc3ac23d
--- /dev/null
+++ b/src/plugins/python-lsp-server/gbp-pylsp-formatter.c
@@ -0,0 +1,65 @@
+/* gbp-pylsp-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-pylsp-formatter"
+
+#include "config.h"
+
+#include "gbp-pylsp-formatter.h"
+#include "gbp-pylsp-service.h"
+
+struct _GbpPylspFormatter
+{
+  IdeLspFormatter parent_instance;
+};
+
+static void
+gbp_pylsp_formatter_load (IdeFormatter *provider)
+{
+  g_autoptr(IdeLspServiceClass) klass = NULL;
+
+  IDE_ENTRY;
+
+  g_assert (GBP_IS_PYLSP_FORMATTER (provider));
+
+  klass = g_type_class_ref (GBP_TYPE_PYLSP_SERVICE);
+  ide_lsp_service_class_bind_client (klass, IDE_OBJECT (provider));
+
+  IDE_EXIT;
+}
+
+static void
+formatter_iface_init (IdeFormatterInterface *iface)
+{
+  iface->load = gbp_pylsp_formatter_load;
+}
+
+G_DEFINE_FINAL_TYPE_WITH_CODE (GbpPylspFormatter, gbp_pylsp_formatter, IDE_TYPE_LSP_FORMATTER,
+                               G_IMPLEMENT_INTERFACE (IDE_TYPE_FORMATTER, formatter_iface_init))
+
+static void
+gbp_pylsp_formatter_class_init (GbpPylspFormatterClass *klass)
+{
+}
+
+static void
+gbp_pylsp_formatter_init (GbpPylspFormatter *self)
+{
+}
diff --git a/src/plugins/python-lsp-server/gbp-pylsp-formatter.h 
b/src/plugins/python-lsp-server/gbp-pylsp-formatter.h
new file mode 100644
index 000000000..f7d13703a
--- /dev/null
+++ b/src/plugins/python-lsp-server/gbp-pylsp-formatter.h
@@ -0,0 +1,31 @@
+/* gbp-pylsp-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_PYLSP_FORMATTER (gbp_pylsp_formatter_get_type())
+
+G_DECLARE_FINAL_TYPE (GbpPylspFormatter, gbp_pylsp_formatter, GBP, PYLSP_FORMATTER, IdeLspFormatter)
+
+G_END_DECLS
diff --git a/src/plugins/python-lsp-server/gbp-pylsp-highlighter.c 
b/src/plugins/python-lsp-server/gbp-pylsp-highlighter.c
new file mode 100644
index 000000000..94ac50211
--- /dev/null
+++ b/src/plugins/python-lsp-server/gbp-pylsp-highlighter.c
@@ -0,0 +1,65 @@
+/* gbp-pylsp-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-pylsp-highlighter"
+
+#include "config.h"
+
+#include "gbp-pylsp-highlighter.h"
+#include "gbp-pylsp-service.h"
+
+struct _GbpPylspHighlighter
+{
+  IdeLspHighlighter parent_instance;
+};
+
+static void
+gbp_pylsp_highlighter_load (IdeHighlighter *provider)
+{
+  g_autoptr(IdeLspServiceClass) klass = NULL;
+
+  IDE_ENTRY;
+
+  g_assert (GBP_IS_PYLSP_HIGHLIGHTER (provider));
+
+  klass = g_type_class_ref (GBP_TYPE_PYLSP_SERVICE);
+  ide_lsp_service_class_bind_client (klass, IDE_OBJECT (provider));
+
+  IDE_EXIT;
+}
+
+static void
+highlighter_iface_init (IdeHighlighterInterface *iface)
+{
+  iface->load = gbp_pylsp_highlighter_load;
+}
+
+G_DEFINE_FINAL_TYPE_WITH_CODE (GbpPylspHighlighter, gbp_pylsp_highlighter, IDE_TYPE_LSP_HIGHLIGHTER,
+                               G_IMPLEMENT_INTERFACE (IDE_TYPE_HIGHLIGHTER, highlighter_iface_init))
+
+static void
+gbp_pylsp_highlighter_class_init (GbpPylspHighlighterClass *klass)
+{
+}
+
+static void
+gbp_pylsp_highlighter_init (GbpPylspHighlighter *self)
+{
+}
diff --git a/src/plugins/python-lsp-server/gbp-pylsp-highlighter.h 
b/src/plugins/python-lsp-server/gbp-pylsp-highlighter.h
new file mode 100644
index 000000000..28468bb04
--- /dev/null
+++ b/src/plugins/python-lsp-server/gbp-pylsp-highlighter.h
@@ -0,0 +1,31 @@
+/* gbp-pylsp-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_PYLSP_HIGHLIGHTER (gbp_pylsp_highlighter_get_type())
+
+G_DECLARE_FINAL_TYPE (GbpPylspHighlighter, gbp_pylsp_highlighter, GBP, PYLSP_HIGHLIGHTER, IdeLspHighlighter)
+
+G_END_DECLS
diff --git a/src/plugins/python-lsp-server/gbp-pylsp-hover-provider.c 
b/src/plugins/python-lsp-server/gbp-pylsp-hover-provider.c
new file mode 100644
index 000000000..3714ede4d
--- /dev/null
+++ b/src/plugins/python-lsp-server/gbp-pylsp-hover-provider.c
@@ -0,0 +1,66 @@
+/* gbp-pylsp-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-pylsp-hover-provider"
+
+#include "config.h"
+
+#include "gbp-pylsp-hover-provider.h"
+#include "gbp-pylsp-service.h"
+
+struct _GbpPylspHoverProvider
+{
+  IdeLspHoverProvider parent_instance;
+};
+
+static void
+gbp_pylsp_hover_provider_prepare (IdeLspHoverProvider *provider)
+{
+  g_autoptr(IdeLspServiceClass) klass = NULL;
+
+  IDE_ENTRY;
+
+  g_assert (GBP_IS_PYLSP_HOVER_PROVIDER (provider));
+
+  g_object_set (provider,
+                "category", "Python",
+                "priority", 200,
+                NULL);
+
+  klass = g_type_class_ref (GBP_TYPE_PYLSP_SERVICE);
+  ide_lsp_service_class_bind_client (klass, IDE_OBJECT (provider));
+
+  IDE_EXIT;
+}
+
+G_DEFINE_FINAL_TYPE (GbpPylspHoverProvider, gbp_pylsp_hover_provider, IDE_TYPE_LSP_HOVER_PROVIDER)
+
+static void
+gbp_pylsp_hover_provider_class_init (GbpPylspHoverProviderClass *klass)
+{
+  IdeLspHoverProviderClass *lsp_hover_provider_class = IDE_LSP_HOVER_PROVIDER_CLASS (klass);
+
+  lsp_hover_provider_class->prepare = gbp_pylsp_hover_provider_prepare;
+}
+
+static void
+gbp_pylsp_hover_provider_init (GbpPylspHoverProvider *self)
+{
+}
diff --git a/src/plugins/python-lsp-server/gbp-pylsp-hover-provider.h 
b/src/plugins/python-lsp-server/gbp-pylsp-hover-provider.h
new file mode 100644
index 000000000..0b2894767
--- /dev/null
+++ b/src/plugins/python-lsp-server/gbp-pylsp-hover-provider.h
@@ -0,0 +1,31 @@
+/* gbp-pylsp-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_PYLSP_HOVER_PROVIDER (gbp_pylsp_hover_provider_get_type())
+
+G_DECLARE_FINAL_TYPE (GbpPylspHoverProvider, gbp_pylsp_hover_provider, GBP, PYLSP_HOVER_PROVIDER, 
IdeLspHoverProvider)
+
+G_END_DECLS
diff --git a/src/plugins/python-lsp-server/gbp-pylsp-rename-provider.c 
b/src/plugins/python-lsp-server/gbp-pylsp-rename-provider.c
new file mode 100644
index 000000000..5d56cc518
--- /dev/null
+++ b/src/plugins/python-lsp-server/gbp-pylsp-rename-provider.c
@@ -0,0 +1,65 @@
+/* gbp-pylsp-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-pylsp-rename-provider"
+
+#include "config.h"
+
+#include "gbp-pylsp-rename-provider.h"
+#include "gbp-pylsp-service.h"
+
+struct _GbpPylspRenameProvider
+{
+  IdeLspRenameProvider parent_instance;
+};
+
+static void
+gbp_pylsp_rename_provider_load (IdeRenameProvider *provider)
+{
+  g_autoptr(IdeLspServiceClass) klass = NULL;
+
+  IDE_ENTRY;
+
+  g_assert (GBP_IS_PYLSP_RENAME_PROVIDER (provider));
+
+  klass = g_type_class_ref (GBP_TYPE_PYLSP_SERVICE);
+  ide_lsp_service_class_bind_client (klass, IDE_OBJECT (provider));
+
+  IDE_EXIT;
+}
+
+static void
+rename_provider_iface_init (IdeRenameProviderInterface *iface)
+{
+  iface->load = gbp_pylsp_rename_provider_load;
+}
+
+G_DEFINE_FINAL_TYPE_WITH_CODE (GbpPylspRenameProvider, gbp_pylsp_rename_provider, 
IDE_TYPE_LSP_RENAME_PROVIDER,
+                               G_IMPLEMENT_INTERFACE (IDE_TYPE_RENAME_PROVIDER, rename_provider_iface_init))
+
+static void
+gbp_pylsp_rename_provider_class_init (GbpPylspRenameProviderClass *klass)
+{
+}
+
+static void
+gbp_pylsp_rename_provider_init (GbpPylspRenameProvider *self)
+{
+}
diff --git a/src/plugins/python-lsp-server/gbp-pylsp-rename-provider.h 
b/src/plugins/python-lsp-server/gbp-pylsp-rename-provider.h
new file mode 100644
index 000000000..46a7fbcd9
--- /dev/null
+++ b/src/plugins/python-lsp-server/gbp-pylsp-rename-provider.h
@@ -0,0 +1,31 @@
+/* gbp-pylsp-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_PYLSP_RENAME_PROVIDER (gbp_pylsp_rename_provider_get_type())
+
+G_DECLARE_FINAL_TYPE (GbpPylspRenameProvider, gbp_pylsp_rename_provider, GBP, PYLSP_RENAME_PROVIDER, 
IdeLspRenameProvider)
+
+G_END_DECLS
diff --git a/src/plugins/python-lsp-server/gbp-pylsp-service.c 
b/src/plugins/python-lsp-server/gbp-pylsp-service.c
new file mode 100644
index 000000000..d52676e5e
--- /dev/null
+++ b/src/plugins/python-lsp-server/gbp-pylsp-service.c
@@ -0,0 +1,72 @@
+/* gbp-pylsp-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-pylsp-service"
+
+#include "config.h"
+
+#include <jsonrpc-glib.h>
+
+#include "gbp-pylsp-service.h"
+
+struct _GbpPylspService
+{
+  IdeLspService parent_instance;
+};
+
+G_DEFINE_FINAL_TYPE (GbpPylspService, gbp_pylsp_service, IDE_TYPE_LSP_SERVICE)
+
+static void
+gbp_pylsp_service_configure_client (IdeLspService *service,
+                                    IdeLspClient  *client)
+{
+  g_autoptr(GVariant) params = NULL;
+
+  IDE_ENTRY;
+
+  g_assert (GBP_IS_PYLSP_SERVICE (service));
+  g_assert (IDE_IS_LSP_CLIENT (client));
+
+  ide_lsp_client_add_language (client, "python");
+
+  params = JSONRPC_MESSAGE_NEW (
+    "autoImportModules", "[",
+      JSONRPC_MESSAGE_PUT_STRING ("gi"),
+    "]"
+  );
+
+  ide_lsp_client_set_initialization_options (client, params);
+
+  IDE_EXIT;
+}
+
+static void
+gbp_pylsp_service_class_init (GbpPylspServiceClass *klass)
+{
+  IdeLspServiceClass *lsp_service_class = IDE_LSP_SERVICE_CLASS (klass);
+
+  lsp_service_class->configure_client = gbp_pylsp_service_configure_client;
+}
+
+static void
+gbp_pylsp_service_init (GbpPylspService *self)
+{
+  ide_lsp_service_set_program (IDE_LSP_SERVICE (self), "pylsp");
+}
diff --git a/src/plugins/python-lsp-server/gbp-pylsp-service.h 
b/src/plugins/python-lsp-server/gbp-pylsp-service.h
new file mode 100644
index 000000000..aaa8897b4
--- /dev/null
+++ b/src/plugins/python-lsp-server/gbp-pylsp-service.h
@@ -0,0 +1,31 @@
+/* gbp-pylsp-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_PYLSP_SERVICE (gbp_pylsp_service_get_type())
+
+G_DECLARE_FINAL_TYPE (GbpPylspService, gbp_pylsp_service, GBP, PYLSP_SERVICE, IdeLspService)
+
+G_END_DECLS
diff --git a/src/plugins/python-lsp-server/gbp-pylsp-symbol-resolver.c 
b/src/plugins/python-lsp-server/gbp-pylsp-symbol-resolver.c
new file mode 100644
index 000000000..42b5468f7
--- /dev/null
+++ b/src/plugins/python-lsp-server/gbp-pylsp-symbol-resolver.c
@@ -0,0 +1,65 @@
+/* gbp-pylsp-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-pylsp-symbol-resolver"
+
+#include "config.h"
+
+#include "gbp-pylsp-symbol-resolver.h"
+#include "gbp-pylsp-service.h"
+
+struct _GbpPylspSymbolResolver
+{
+  IdeLspSymbolResolver parent_instance;
+};
+
+static void
+gbp_pylsp_symbol_provider_load (IdeSymbolResolver *provider)
+{
+  g_autoptr(IdeLspServiceClass) klass = NULL;
+
+  IDE_ENTRY;
+
+  g_assert (GBP_IS_PYLSP_SYMBOL_RESOLVER (provider));
+
+  klass = g_type_class_ref (GBP_TYPE_PYLSP_SERVICE);
+  ide_lsp_service_class_bind_client (klass, IDE_OBJECT (provider));
+
+  IDE_EXIT;
+}
+
+static void
+symbol_provider_iface_init (IdeSymbolResolverInterface *iface)
+{
+  iface->load = gbp_pylsp_symbol_provider_load;
+}
+
+G_DEFINE_FINAL_TYPE_WITH_CODE (GbpPylspSymbolResolver, gbp_pylsp_symbol_provider, 
IDE_TYPE_LSP_SYMBOL_RESOLVER,
+                               G_IMPLEMENT_INTERFACE (IDE_TYPE_SYMBOL_RESOLVER, symbol_provider_iface_init))
+
+static void
+gbp_pylsp_symbol_provider_class_init (GbpPylspSymbolResolverClass *klass)
+{
+}
+
+static void
+gbp_pylsp_symbol_provider_init (GbpPylspSymbolResolver *self)
+{
+}
diff --git a/src/plugins/python-lsp-server/gbp-pylsp-symbol-resolver.h 
b/src/plugins/python-lsp-server/gbp-pylsp-symbol-resolver.h
new file mode 100644
index 000000000..7fe3fb6c3
--- /dev/null
+++ b/src/plugins/python-lsp-server/gbp-pylsp-symbol-resolver.h
@@ -0,0 +1,31 @@
+/* gbp-pylsp-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_PYLSP_SYMBOL_RESOLVER (gbp_pylsp_symbol_provider_get_type())
+
+G_DECLARE_FINAL_TYPE (GbpPylspSymbolResolver, gbp_pylsp_symbol_provider, GBP, PYLSP_SYMBOL_RESOLVER, 
IdeLspSymbolResolver)
+
+G_END_DECLS
diff --git a/src/plugins/python-lsp-server/meson.build b/src/plugins/python-lsp-server/meson.build
new file mode 100644
index 000000000..2ff5076e1
--- /dev/null
+++ b/src/plugins/python-lsp-server/meson.build
@@ -0,0 +1,24 @@
+if get_option('plugin_python_lsp_server')
+
+plugins_sources += files([
+  'pylsp-language-server-plugin.c',
+  'gbp-pylsp-code-action-provider.c',
+  'gbp-pylsp-completion-provider.c',
+  'gbp-pylsp-diagnostic-provider.c',
+  'gbp-pylsp-formatter.c',
+  'gbp-pylsp-highlighter.c',
+  'gbp-pylsp-hover-provider.c',
+  'gbp-pylsp-rename-provider.c',
+  'gbp-pylsp-symbol-resolver.c',
+  'gbp-pylsp-service.c',
+])
+
+plugin_pylsp_resources = gnome.compile_resources(
+  'pylsp-language-server-resources',
+  'pylsp-language-server.gresource.xml',
+  c_name: 'gbp_pylsp',
+)
+
+plugins_sources += plugin_pylsp_resources
+
+endif
diff --git a/src/plugins/python-lsp-server/pylsp-language-server-plugin.c 
b/src/plugins/python-lsp-server/pylsp-language-server-plugin.c
new file mode 100644
index 000000000..529f5738d
--- /dev/null
+++ b/src/plugins/python-lsp-server/pylsp-language-server-plugin.c
@@ -0,0 +1,68 @@
+/* pylsp-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 "pylsp-language-server-plugin"
+
+#include "config.h"
+
+#include <libpeas/peas.h>
+
+#include <libide-code.h>
+#include <libide-foundry.h>
+#include <libide-lsp.h>
+
+#include "gbp-pylsp-service.h"
+#include "gbp-pylsp-completion-provider.h"
+#include "gbp-pylsp-diagnostic-provider.h"
+#include "gbp-pylsp-symbol-resolver.h"
+#include "gbp-pylsp-highlighter.h"
+#include "gbp-pylsp-formatter.h"
+#include "gbp-pylsp-rename-provider.h"
+#include "gbp-pylsp-hover-provider.h"
+#include "gbp-pylsp-code-action-provider.h"
+
+_IDE_EXTERN void
+_gbp_pylsp_register_types (PeasObjectModule *module)
+{
+  peas_object_module_register_extension_type (module,
+                                              IDE_TYPE_DIAGNOSTIC_PROVIDER,
+                                              GBP_TYPE_PYLSP_DIAGNOSTIC_PROVIDER);
+  peas_object_module_register_extension_type (module,
+                                              GTK_SOURCE_TYPE_COMPLETION_PROVIDER,
+                                              GBP_TYPE_PYLSP_COMPLETION_PROVIDER);
+  peas_object_module_register_extension_type (module,
+                                              IDE_TYPE_SYMBOL_RESOLVER,
+                                              GBP_TYPE_PYLSP_SYMBOL_RESOLVER);
+  peas_object_module_register_extension_type (module,
+                                              IDE_TYPE_HIGHLIGHTER,
+                                              GBP_TYPE_PYLSP_HIGHLIGHTER);
+  peas_object_module_register_extension_type (module,
+                                              IDE_TYPE_FORMATTER,
+                                              GBP_TYPE_PYLSP_FORMATTER);
+  peas_object_module_register_extension_type (module,
+                                              GTK_SOURCE_TYPE_HOVER_PROVIDER,
+                                              GBP_TYPE_PYLSP_HOVER_PROVIDER);
+  peas_object_module_register_extension_type (module,
+                                              IDE_TYPE_RENAME_PROVIDER,
+                                              GBP_TYPE_PYLSP_RENAME_PROVIDER);
+  peas_object_module_register_extension_type (module,
+                                              IDE_TYPE_CODE_ACTION_PROVIDER,
+                                              GBP_TYPE_PYLSP_CODE_ACTION_PROVIDER);
+}
diff --git a/src/plugins/python-lsp-server/pylsp-language-server.gresource.xml 
b/src/plugins/python-lsp-server/pylsp-language-server.gresource.xml
new file mode 100644
index 000000000..7859f66f5
--- /dev/null
+++ b/src/plugins/python-lsp-server/pylsp-language-server.gresource.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+  <gresource prefix="/plugins/pylsp-language-server">
+    <file>pylsp-language-server.plugin</file>
+  </gresource>
+</gresources>
diff --git a/src/plugins/python-lsp-server/pylsp-language-server.plugin 
b/src/plugins/python-lsp-server/pylsp-language-server.plugin
new file mode 100644
index 000000000..170c9d331
--- /dev/null
+++ b/src/plugins/python-lsp-server/pylsp-language-server.plugin
@@ -0,0 +1,16 @@
+[Plugin]
+Builtin=true
+Copyright=Copyright © 2022 Christian Hergert
+Description=Provides integration with the pylsp language server for Python
+Embedded=_gbp_pylsp_register_types
+Module=pylsp-language-server
+Name=Python Language Server (PyLSP)
+X-Category=lsps
+X-Completion-Provider-Languages=python,python3
+X-Symbol-Resolver-Languages=python,python3
+X-Diagnostic-Provider-Languages=python,python3
+X-Highlighter-Languages=python,python3
+X-Hover-Provider-Languages=python,python3
+X-Rename-Provider-Languages=python,python3
+X-Formatter-Languages=python,python3
+X-Code-Action-Languages=python,python3


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