mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-12 21:28:51 +00:00
Make from-source install use cargo installed binary by default
This commit is contained in:
parent
467a040509
commit
4b5435b52b
6 changed files with 6 additions and 21 deletions
|
@ -95,12 +95,6 @@ $ cargo xtask install
|
||||||
----
|
----
|
||||||
|
|
||||||
You'll need Cargo, nodejs and npm for this.
|
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.
|
Note that installing via `xtask install` does not work for VS Code Remote, instead you'll need to install the `.vsix` manually.
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
"private": true,
|
"private": true,
|
||||||
"icon": "icon.png",
|
"icon": "icon.png",
|
||||||
"version": "0.4.0-dev",
|
"version": "0.4.0-dev",
|
||||||
"releaseTag": "nightly",
|
"releaseTag": null,
|
||||||
"publisher": "matklad",
|
"publisher": "matklad",
|
||||||
"repository": {
|
"repository": {
|
||||||
"url": "https://github.com/rust-analyzer/rust-analyzer.git",
|
"url": "https://github.com/rust-analyzer/rust-analyzer.git",
|
||||||
|
|
|
@ -44,11 +44,11 @@ export class Config {
|
||||||
.packageJSON
|
.packageJSON
|
||||||
.version;
|
.version;
|
||||||
|
|
||||||
readonly releaseTag: string = vscode
|
readonly releaseTag: string | undefined = vscode
|
||||||
.extensions
|
.extensions
|
||||||
.getExtension(this.extensionId)!
|
.getExtension(this.extensionId)!
|
||||||
.packageJSON
|
.packageJSON
|
||||||
.releaseTag;
|
.releaseTag ?? undefined;
|
||||||
|
|
||||||
private cfg!: vscode.WorkspaceConfiguration;
|
private cfg!: vscode.WorkspaceConfiguration;
|
||||||
|
|
||||||
|
|
|
@ -110,6 +110,7 @@ async function bootstrap(config: Config, state: PersistentState): Promise<string
|
||||||
}
|
}
|
||||||
|
|
||||||
async function bootstrapExtension(config: Config, state: PersistentState): Promise<void> {
|
async function bootstrapExtension(config: Config, state: PersistentState): Promise<void> {
|
||||||
|
if (config.releaseTag === undefined) return;
|
||||||
if (config.channel === "stable") {
|
if (config.channel === "stable") {
|
||||||
if (config.releaseTag === NIGHTLY_TAG) {
|
if (config.releaseTag === NIGHTLY_TAG) {
|
||||||
vscode.window.showWarningMessage(`You are running a nightly version of rust-analyzer extension.
|
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;
|
return explicitPath;
|
||||||
};
|
};
|
||||||
|
if (config.releaseTag === undefined) return "rust-analyzer";
|
||||||
|
|
||||||
let binaryName: string | undefined = undefined;
|
let binaryName: string | undefined = undefined;
|
||||||
if (process.arch === "x64" || process.arch === "x32") {
|
if (process.arch === "x64" || process.arch === "x32") {
|
||||||
|
|
|
@ -27,7 +27,7 @@ fn dist_client(version: &str, release_tag: &str) -> Result<()> {
|
||||||
|
|
||||||
patch
|
patch
|
||||||
.replace(r#""version": "0.4.0-dev""#, &format!(r#""version": "{}""#, version))
|
.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 {
|
if nightly {
|
||||||
patch.replace(
|
patch.replace(
|
||||||
|
|
|
@ -24,7 +24,6 @@ pub struct ServerOpt {
|
||||||
|
|
||||||
impl InstallCmd {
|
impl InstallCmd {
|
||||||
pub fn run(self) -> Result<()> {
|
pub fn run(self) -> Result<()> {
|
||||||
let both = self.server.is_some() && self.client.is_some();
|
|
||||||
if cfg!(target_os = "macos") {
|
if cfg!(target_os = "macos") {
|
||||||
fix_path_for_mac().context("Fix path for mac")?
|
fix_path_for_mac().context("Fix path for mac")?
|
||||||
}
|
}
|
||||||
|
@ -34,16 +33,6 @@ impl InstallCmd {
|
||||||
if let Some(client) = self.client {
|
if let Some(client) = self.client {
|
||||||
install_client(client).context("install 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(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue