[gnome-builder] rust-analyzer: try .local/bin/rust-analyzer



commit b86ae157fe8891b59c06ff9bd420f15d9d81db95
Author: Christian Hergert <chergert redhat com>
Date:   Sun Dec 26 13:57:36 2021 -0800

    rust-analyzer: try .local/bin/rust-analyzer
    
    This tries to locate rust-analyzer on the host at
    ~/.local/bin/rust-analyzer instead of just ~/.cargo/bin/rust-analyzer.
    
    Related #1384

 src/plugins/rust-analyzer/rust-analyzer-pipeline-addin.c | 9 +++++++++
 1 file changed, 9 insertions(+)
---
diff --git a/src/plugins/rust-analyzer/rust-analyzer-pipeline-addin.c 
b/src/plugins/rust-analyzer/rust-analyzer-pipeline-addin.c
index 71cdce0d9..13a3a1ddf 100644
--- a/src/plugins/rust-analyzer/rust-analyzer-pipeline-addin.c
+++ b/src/plugins/rust-analyzer/rust-analyzer-pipeline-addin.c
@@ -289,6 +289,7 @@ rust_analyzer_pipeline_addin_load (IdePipelineAddin *addin,
   IdeBuildSystem *buildsystem = NULL;
   g_autoptr(GFile) cargo_home = NULL;
   g_autoptr(GFile) file = NULL;
+  g_autofree char *local_path = NULL;
 
   IDE_ENTRY;
 
@@ -318,6 +319,14 @@ rust_analyzer_pipeline_addin_load (IdePipelineAddin *addin,
       IDE_EXIT;
     }
 
+  /* Try ~/.local/bin/ where rust-analyzer suggests installation */
+  local_path = g_build_filename (g_get_home_dir (), ".local", "bin", "rust-analyzer", NULL);
+  if (g_file_test (local_path, G_FILE_TEST_IS_EXECUTABLE))
+    {
+      set_path (self, local_path, NULL);
+      IDE_EXIT;
+    }
+
   self->notif = ide_notification_new ();
   ide_notification_set_title (self->notif, "Rust-analyzer is missing");
   ide_notification_set_body (self->notif, "Install rust-analyzer in your PATH using rustup, or use the Rust 
flatpak extension in your manifest.");


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