[gnome-builder/bilelmoussaoui/rust-analyzer] r-a: Opt-in for the proc-macro expansion feature




commit 6c7b6baea5f11438ad1d08439d6ec5ccfa586fed
Author: Bilal Elmoussaoui <belmouss redhat com>
Date:   Thu Feb 3 21:27:30 2022 +0100

    r-a: Opt-in for the proc-macro expansion feature
    
    The proc-macro feature in r-a is still experimental, although without
    it the experience with code that uses proc macros is sub-optimal.
    
    As gtk-rs apps (the most common use case for Builder/Rust) make heavy use of macros
    let us opt-in for that by default

 src/plugins/rust-analyzer/rust-analyzer-service.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/src/plugins/rust-analyzer/rust-analyzer-service.c 
b/src/plugins/rust-analyzer/rust-analyzer-service.c
index 118a8c5f7..1b357c3ee 100644
--- a/src/plugins/rust-analyzer/rust-analyzer-service.c
+++ b/src/plugins/rust-analyzer/rust-analyzer-service.c
@@ -107,8 +107,15 @@ rust_analyzer_service_lsp_initialized_cb (RustAnalyzerService *self,
   g_assert (RUST_IS_ANALYZER_SERVICE (self));
   g_assert (IDE_IS_LSP_CLIENT (client));
 
-  params = JSONRPC_MESSAGE_NEW ("settings", "");
-
+  // Opt-in for the experimental proc-macro feature
+  // See https://rust-analyzer.github.io/manual.html#configuration for details
+  params = JSONRPC_MESSAGE_NEW (
+    "settings", "{",
+      "procMacro", "{",
+        "enable", JSONRPC_MESSAGE_PUT_BOOLEAN(TRUE),
+      "}",
+    "}"
+  );
   ide_lsp_client_send_notification_async (client,
                                           "workspace/didChangeConfiguration",
                                           params,


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