[gnome-builder/bilelmoussaoui/rust-analyzer] r-a: Opt-in for the proc-macro expansion feature
- From: Bilal Elmoussaoui <bilelmoussaoui src gnome org>
 
- To: commits-list gnome org
 
- Cc: 
 
- Subject: [gnome-builder/bilelmoussaoui/rust-analyzer] r-a: Opt-in for the proc-macro expansion feature
 
- Date: Thu,  3 Feb 2022 21:04:18 +0000 (UTC)
 
commit c6d1c2e300b877b66493ff5c8d25039035264d9d
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..ef8902925 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]