Merge pull request #77752 from oxalica/rust-analyzer
rust-analyzer: init at unstable-2020-03-09
This commit is contained in:
@@ -140,6 +140,8 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
matklad.rust-analyzer = callPackage ./rust-analyzer {};
|
||||
|
||||
scala-lang.scala = buildVscodeMarketplaceExtension {
|
||||
mktplcRef = {
|
||||
name = "scala";
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"name": "rust-analyzer",
|
||||
"version": "0.4.0-dev",
|
||||
"dependencies": {
|
||||
"jsonc-parser": "^2.2.1",
|
||||
"node-fetch": "^2.6.0",
|
||||
"vscode-languageclient": "6.1.3",
|
||||
"@rollup/plugin-commonjs": "^11.0.2",
|
||||
"@rollup/plugin-node-resolve": "^7.1.1",
|
||||
"@types/node": "^12.12.34",
|
||||
"@types/node-fetch": "^2.5.5",
|
||||
"@types/vscode": "1.43.0",
|
||||
"@typescript-eslint/eslint-plugin": "^2.26.0",
|
||||
"@typescript-eslint/parser": "^2.26.0",
|
||||
"eslint": "^6.8.0",
|
||||
"rollup": "^2.3.2",
|
||||
"tslib": "^1.11.1",
|
||||
"typescript": "^3.8.3",
|
||||
"typescript-formatter": "^7.2.2",
|
||||
"vsce": "^1.75.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
# Update script: pkgs/development/tools/rust/rust-analyzer/update.sh
|
||||
{ lib, stdenv, vscode-utils, jq, rust-analyzer, nodePackages_10_x
|
||||
, setDefaultServerPath ? true
|
||||
}:
|
||||
|
||||
let
|
||||
pname = "rust-analyzer";
|
||||
publisher = "matklad";
|
||||
|
||||
# Follow the unstable version of rust-analyzer, since the extension is not stable yet.
|
||||
inherit (rust-analyzer) version;
|
||||
|
||||
build-deps = nodePackages_10_x."rust-analyzer-build-deps-../../misc/vscode-extensions/rust-analyzer/build-deps";
|
||||
# FIXME: Making a new derivation to link `node_modules` and run `npm run package`
|
||||
# will cause a build failure.
|
||||
vsix = build-deps.override {
|
||||
src = "${rust-analyzer.src}/editors/code";
|
||||
outputs = [ "vsix" "out" ];
|
||||
|
||||
postInstall = ''
|
||||
npm run package
|
||||
mkdir $vsix
|
||||
cp ${pname}.vsix $vsix/${pname}.zip
|
||||
'';
|
||||
};
|
||||
|
||||
in vscode-utils.buildVscodeExtension {
|
||||
inherit version vsix;
|
||||
name = "${pname}-${version}";
|
||||
src = "${vsix}/${pname}.zip";
|
||||
vscodeExtUniqueId = "${publisher}.${pname}";
|
||||
|
||||
nativeBuildInputs = lib.optional setDefaultServerPath jq;
|
||||
|
||||
postFixup = lib.optionalString setDefaultServerPath ''
|
||||
package_json="$out/${publisher}.${pname}/package.json"
|
||||
jq '.contributes.configuration.properties."rust-analyzer.serverPath".default = $s' \
|
||||
--arg s "${rust-analyzer}/bin/rust-analyzer" \
|
||||
$package_json >$package_json.new
|
||||
mv $package_json.new $package_json
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "An alternative rust language server to the RLS";
|
||||
homepage = "https://github.com/rust-analyzer/rust-analyzer";
|
||||
license = with licenses; [ mit asl20 ];
|
||||
maintainers = with maintainers; [ oxalica ];
|
||||
platforms = platforms.all;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user