From 4a6e602c9419cc5ed464343b2373c7fe86fb89d6 Mon Sep 17 00:00:00 2001 From: Benjamin Bouvier Date: Thu, 11 Feb 2021 17:34:56 +0100 Subject: Allow automatically detect the rustc-src directory (fixes #3517). If the configured rustcSource is set to "discover", try to automatically detect a source from the sysroot rustc directory. --- editors/code/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'editors/code') diff --git a/editors/code/package.json b/editors/code/package.json index 55825456e..defa108cb 100644 --- a/editors/code/package.json +++ b/editors/code/package.json @@ -707,7 +707,7 @@ } }, "rust-analyzer.rustcSource": { - "markdownDescription": "Path to the rust compiler sources, for usage in rustc_private projects.", + "markdownDescription": "Path to the rust compiler sources, for usage in rustc_private projects, or \"discover\" to try to automatically find it.", "default": null, "type": [ "null", -- cgit v1.2.3 From 471795b019d800dca65e2a400fbdb166e6f821cd Mon Sep 17 00:00:00 2001 From: Yaroslav Bolyukin Date: Sat, 13 Feb 2021 23:11:00 +0300 Subject: fix: tolerate spaces in nix binary patching If path to original file contains space (I.e on code insiders, where default data directory is ~/Code - Insiders/), then there is syntax error evaluating src arg. Instead pass path as str, and coerce to path back in nix expression Signed-off-by: Yaroslav Bolyukin --- editors/code/src/main.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'editors/code') diff --git a/editors/code/src/main.ts b/editors/code/src/main.ts index d18d6c8a9..620810d72 100644 --- a/editors/code/src/main.ts +++ b/editors/code/src/main.ts @@ -246,10 +246,10 @@ async function patchelf(dest: PathLike): Promise { }, async (progress, _) => { const expression = ` - {src, pkgs ? import {}}: + {srcStr, pkgs ? import {}}: pkgs.stdenv.mkDerivation { name = "rust-analyzer"; - inherit src; + src = /. + srcStr; phases = [ "installPhase" "fixupPhase" ]; installPhase = "cp $src $out"; fixupPhase = '' @@ -262,7 +262,7 @@ async function patchelf(dest: PathLike): Promise { await fs.rename(dest, origFile); progress.report({ message: "Patching executable", increment: 20 }); await new Promise((resolve, reject) => { - const handle = exec(`nix-build -E - --arg src '${origFile}' -o ${dest}`, + const handle = exec(`nix-build -E - --argstr srcStr '${origFile}' -o '${dest}'`, (err, stdout, stderr) => { if (err != null) { reject(Error(stderr)); -- cgit v1.2.3