[gnome-builder/wip/chergert/lsp-plugin-loader] plugins/rust-analyzer: port to generic LSP plugin



commit 2044fab14d98c703b38c95d1fa00cfb8a395c386
Author: Christian Hergert <chergert redhat com>
Date:   Fri Oct 14 11:44:14 2022 -0500

    plugins/rust-analyzer: port to generic LSP plugin
    
    This removes some features, such as the rust-analyzer tweaks addin. But
    we want to solve this more generically so it is the same across all of the
    language servers (and probably more similar to VS Code).
    
    We'll re-introduce other ways to tweak settings, but it may be more like a
    settings.json editing.

 .../gbp-rust-analyzer-code-action-provider.c       |  65 -------
 .../gbp-rust-analyzer-code-action-provider.h       |  31 ---
 .../gbp-rust-analyzer-completion-provider.c        |  61 ------
 .../gbp-rust-analyzer-completion-provider.h        |  31 ---
 .../gbp-rust-analyzer-diagnostic-provider.c        |  65 -------
 .../gbp-rust-analyzer-diagnostic-provider.h        |  31 ---
 .../rust-analyzer/gbp-rust-analyzer-formatter.c    |  65 -------
 .../rust-analyzer/gbp-rust-analyzer-formatter.h    |  31 ---
 .../rust-analyzer/gbp-rust-analyzer-highlighter.c  |  65 -------
 .../rust-analyzer/gbp-rust-analyzer-highlighter.h  |  31 ---
 .../gbp-rust-analyzer-hover-provider.c             |  66 -------
 .../gbp-rust-analyzer-hover-provider.h             |  31 ---
 .../gbp-rust-analyzer-rename-provider.c            |  65 -------
 .../gbp-rust-analyzer-rename-provider.h            |  31 ---
 .../gbp-rust-analyzer-search-provider.c            |  85 ---------
 .../gbp-rust-analyzer-search-provider.h            |  31 ---
 .../rust-analyzer/gbp-rust-analyzer-service.c      | 209 ---------------------
 .../rust-analyzer/gbp-rust-analyzer-service.h      |  31 ---
 .../gbp-rust-analyzer-symbol-resolver.c            |  65 -------
 .../gbp-rust-analyzer-symbol-resolver.h            |  31 ---
 .../rust-analyzer/gbp-rust-analyzer-tweaks-addin.c |  44 -----
 .../rust-analyzer/gbp-rust-analyzer-tweaks-addin.h |  31 ---
 src/plugins/rust-analyzer/meson.build              |  17 --
 .../org.gnome.builder.rust-analyzer.gschema.xml    |  15 --
 src/plugins/rust-analyzer/rust-analyzer-plugin.c   |  72 -------
 .../rust-analyzer/rust-analyzer.gresource.xml      |   2 +-
 src/plugins/rust-analyzer/rust-analyzer.plugin     |  11 +-
 src/plugins/rust-analyzer/settings.json            |  21 +++
 src/plugins/rust-analyzer/tweaks.ui                |  96 ----------
 29 files changed, 29 insertions(+), 1401 deletions(-)
---
diff --git a/src/plugins/rust-analyzer/meson.build b/src/plugins/rust-analyzer/meson.build
index eea43bba4..4e2ddf491 100644
--- a/src/plugins/rust-analyzer/meson.build
+++ b/src/plugins/rust-analyzer/meson.build
@@ -1,20 +1,5 @@
 if get_option('plugin_rust_analyzer')
 
-plugins_sources += files([
-  'gbp-rust-analyzer-code-action-provider.c',
-  'gbp-rust-analyzer-completion-provider.c',
-  'gbp-rust-analyzer-diagnostic-provider.c',
-  'gbp-rust-analyzer-formatter.c',
-  'gbp-rust-analyzer-highlighter.c',
-  'gbp-rust-analyzer-hover-provider.c',
-  'gbp-rust-analyzer-rename-provider.c',
-  'gbp-rust-analyzer-search-provider.c',
-  'gbp-rust-analyzer-service.c',
-  'gbp-rust-analyzer-symbol-resolver.c',
-  'gbp-rust-analyzer-tweaks-addin.c',
-  'rust-analyzer-plugin.c',
-])
-
 plugin_rust_analyzer_resources = gnome.compile_resources(
   'rust-analyzer-resources',
   'rust-analyzer.gresource.xml',
@@ -23,6 +8,4 @@ plugin_rust_analyzer_resources = gnome.compile_resources(
 
 plugins_sources += plugin_rust_analyzer_resources
 
-install_data(['org.gnome.builder.rust-analyzer.gschema.xml'], install_dir: schema_dir)
-
 endif
diff --git a/src/plugins/rust-analyzer/rust-analyzer.gresource.xml 
b/src/plugins/rust-analyzer/rust-analyzer.gresource.xml
index 743e1b749..3412021b4 100644
--- a/src/plugins/rust-analyzer/rust-analyzer.gresource.xml
+++ b/src/plugins/rust-analyzer/rust-analyzer.gresource.xml
@@ -2,6 +2,6 @@
 <gresources>
   <gresource prefix="/plugins/rust-analyzer">
     <file>rust-analyzer.plugin</file>
-    <file preprocess="xml-stripblanks">tweaks.ui</file>
+    <file>settings.json</file>
   </gresource>
 </gresources>
diff --git a/src/plugins/rust-analyzer/rust-analyzer.plugin b/src/plugins/rust-analyzer/rust-analyzer.plugin
index 169b0ce0e..0df717058 100644
--- a/src/plugins/rust-analyzer/rust-analyzer.plugin
+++ b/src/plugins/rust-analyzer/rust-analyzer.plugin
@@ -1,12 +1,12 @@
 [Plugin]
-Authors=Günther Wagner <info gunibert de>
+Authors=Günther Wagner <info gunibert de>, Christian Hergert <chergert redhat com>
 Builtin=true
-Copyright=Copyright © 2020 Günther Wagner
+Copyright=Copyright © 2020 Günther Wagner, Copyright © 2022 Christian Hergert
 Depends=buildui;
 Description=Provides integration with the rust-analyzer language server
+Embedded=ide_lsp_plugin_register_types
 Module=rust-analyzer
-Embedded=_gbp_rust_analyzer_register_types
-Name=Rust Language Server
+Name=Rust Analyzer
 X-Category=lsps
 X-Code-Action-Languages=rust
 X-Completion-Provider-Languages=rust
@@ -14,5 +14,8 @@ X-Diagnostic-Provider-Languages=rust
 X-Formatter-Languages=rust
 X-Highlighter-Languages=rust
 X-Hover-Provider-Languages=rust
+X-LSP-Command=rust-analyzer
+X-LSP-Languages=rust
+X-LSP-Settings=settings.json
 X-Rename-Provider-Languages=rust
 X-Symbol-Resolver-Languages=rust
diff --git a/src/plugins/rust-analyzer/settings.json b/src/plugins/rust-analyzer/settings.json
new file mode 100644
index 000000000..e77ba8f1f
--- /dev/null
+++ b/src/plugins/rust-analyzer/settings.json
@@ -0,0 +1,21 @@
+{
+    "rust-analyzer" : {
+        "checkOnSave" : {
+            "enable" : true,
+            "command" : "check"
+        },
+        "cargo" : {
+            "buildScripts" : {
+                "enable" : true
+            }
+        },
+        "procMacro" : {
+            "enable" : true
+        },
+        "rustfmt" : {
+            "rangeFormatting" : {
+                "enable" : true
+            }
+        }
+    }
+}


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