Merge pull request #133084 from happysalada/fix_vscode_rust_analyzer

This commit is contained in:
Sandro 2021-08-08 06:52:49 +02:00 committed by GitHub
commit 820594febb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,6 +1,11 @@
# Update script: pkgs/development/tools/rust/rust-analyzer/update.sh
{ lib, vscode-utils, jq, rust-analyzer, nodePackages
{ lib
, vscode-utils
, jq
, rust-analyzer
, nodePackages
, setDefaultServerPath ? true
, moreutils
}:
let
@ -24,19 +29,19 @@ let
'';
};
in vscode-utils.buildVscodeExtension {
in
vscode-utils.buildVscodeExtension {
inherit version vsix;
name = "${pname}-${version}";
src = "${vsix}/${pname}.zip";
vscodeExtUniqueId = "${publisher}.${pname}";
nativeBuildInputs = lib.optional setDefaultServerPath jq;
nativeBuildInputs = lib.optionals setDefaultServerPath [ jq moreutils ];
preInstall = lib.optionalString setDefaultServerPath ''
jq '.contributes.configuration.properties."rust-analyzer.serverPath".default = $s' \
jq '.contributes.configuration.properties."rust-analyzer.server.path".default = $s' \
--arg s "${rust-analyzer}/bin/rust-analyzer" \
package.json >package.json.new
mv package.json.new package.json
package.json | sponge package.json
'';
meta = with lib; {