3663: Make from-source install use cargo installed binary by default r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
bors[bot] 2020-03-20 12:08:36 +00:00 committed by GitHub
commit 92b561b5c7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 10 additions and 25 deletions

View file

@ -95,12 +95,6 @@ $ cargo xtask install
----
You'll need Cargo, nodejs and npm for this.
To make VS Code use the freshly built server, add this to the settings:
[source,json]
----
{ "rust-analyzer.serverPath": "rust-analyzer" }
----
Note that installing via `xtask install` does not work for VS Code Remote, instead you'll need to install the `.vsix` manually.

View file

@ -1762,9 +1762,9 @@
"integrity": "sha512-JvONPptw3GAQGXlVV2utDcHx0BiY34FupW/kI6mZ5x06ER5DdPG/tXWMVHjTNULF5uKPOUUD0SaXg5QaubJL0A=="
},
"vscode-languageclient": {
"version": "6.1.1",
"resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-6.1.1.tgz",
"integrity": "sha512-mB6d8Tg+82l8EFUfR+SBu0+lCshyKVgC5E5+MQ0/BJa+9AgeBjtG5npoGaCo4/VvWzK0ZRGm85zU5iRp1RYPIA==",
"version": "6.1.3",
"resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-6.1.3.tgz",
"integrity": "sha512-YciJxk08iU5LmWu7j5dUt9/1OLjokKET6rME3cI4BRpiF6HZlusm2ZwPt0MYJ0lV5y43sZsQHhyon2xBg4ZJVA==",
"requires": {
"semver": "^6.3.0",
"vscode-languageserver-protocol": "^3.15.3"

View file

@ -6,7 +6,7 @@
"private": true,
"icon": "icon.png",
"version": "0.4.0-dev",
"releaseTag": "nightly",
"releaseTag": null,
"publisher": "matklad",
"repository": {
"url": "https://github.com/rust-analyzer/rust-analyzer.git",
@ -34,7 +34,7 @@
"dependencies": {
"jsonc-parser": "^2.2.1",
"node-fetch": "^2.6.0",
"vscode-languageclient": "=6.1.1"
"vscode-languageclient": "6.1.3"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^11.0.2",

View file

@ -44,11 +44,11 @@ export class Config {
.packageJSON
.version;
readonly releaseTag: string = vscode
readonly releaseTag: string | undefined = vscode
.extensions
.getExtension(this.extensionId)!
.packageJSON
.releaseTag;
.releaseTag ?? undefined;
private cfg!: vscode.WorkspaceConfiguration;

View file

@ -110,6 +110,7 @@ async function bootstrap(config: Config, state: PersistentState): Promise<string
}
async function bootstrapExtension(config: Config, state: PersistentState): Promise<void> {
if (config.releaseTag === undefined) return;
if (config.channel === "stable") {
if (config.releaseTag === NIGHTLY_TAG) {
vscode.window.showWarningMessage(`You are running a nightly version of rust-analyzer extension.
@ -184,6 +185,7 @@ async function getServer(config: Config, state: PersistentState): Promise<string
}
return explicitPath;
};
if (config.releaseTag === undefined) return "rust-analyzer";
let binaryName: string | undefined = undefined;
if (process.arch === "x64" || process.arch === "x32") {

View file

@ -27,7 +27,7 @@ fn dist_client(version: &str, release_tag: &str) -> Result<()> {
patch
.replace(r#""version": "0.4.0-dev""#, &format!(r#""version": "{}""#, version))
.replace(r#""releaseTag": "nightly""#, &format!(r#""releaseTag": "{}""#, release_tag));
.replace(r#""releaseTag": null"#, &format!(r#""releaseTag": "{}""#, release_tag));
if nightly {
patch.replace(

View file

@ -24,7 +24,6 @@ pub struct ServerOpt {
impl InstallCmd {
pub fn run(self) -> Result<()> {
let both = self.server.is_some() && self.client.is_some();
if cfg!(target_os = "macos") {
fix_path_for_mac().context("Fix path for mac")?
}
@ -34,16 +33,6 @@ impl InstallCmd {
if let Some(client) = self.client {
install_client(client).context("install client")?;
}
if both {
eprintln!(
"
Installation complete.
Add `\"rust-analyzer.serverPath\": \"rust-analyzer\",` to VS Code settings,
otherwise it will use the latest release from GitHub.
"
)
}
Ok(())
}
}