aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--editors/code/package-lock.json2
-rw-r--r--editors/code/package.json3
-rw-r--r--xtask/src/install.rs25
3 files changed, 24 insertions, 6 deletions
diff --git a/editors/code/package-lock.json b/editors/code/package-lock.json
index 5c056463e..a7a1829dd 100644
--- a/editors/code/package-lock.json
+++ b/editors/code/package-lock.json
@@ -1,6 +1,6 @@
1{ 1{
2 "name": "rust-analyzer", 2 "name": "rust-analyzer",
3 "version": "0.1.0", 3 "version": "0.2.0-dev",
4 "lockfileVersion": 1, 4 "lockfileVersion": 1,
5 "requires": true, 5 "requires": true,
6 "dependencies": { 6 "dependencies": {
diff --git a/editors/code/package.json b/editors/code/package.json
index f687eb8d4..2b8e5aec5 100644
--- a/editors/code/package.json
+++ b/editors/code/package.json
@@ -5,7 +5,8 @@
5 "preview": true, 5 "preview": true,
6 "private": true, 6 "private": true,
7 "icon": "icon.png", 7 "icon": "icon.png",
8 "version": "0.1.0", 8 "//": "The real version is in release.yaml, this one just needs to be bigger",
9 "version": "0.2.0-dev",
9 "publisher": "matklad", 10 "publisher": "matklad",
10 "repository": { 11 "repository": {
11 "url": "https://github.com/rust-analyzer/rust-analyzer.git", 12 "url": "https://github.com/rust-analyzer/rust-analyzer.git",
diff --git a/xtask/src/install.rs b/xtask/src/install.rs
index a279598b9..9bddc8d7f 100644
--- a/xtask/src/install.rs
+++ b/xtask/src/install.rs
@@ -1,8 +1,9 @@
1//! Installs rust-analyzer language server and/or editor plugin. 1//! Installs rust-analyzer language server and/or editor plugin.
2 2
3use std::{env, path::PathBuf, str}; 3use std::{env, fs, path::PathBuf, str};
4 4
5use anyhow::{bail, format_err, Context, Result}; 5use anyhow::{bail, format_err, Context, Result};
6use walkdir::WalkDir;
6 7
7use crate::cmd::{run, run_with_output, Cmd}; 8use crate::cmd::{run, run_with_output, Cmd};
8 9
@@ -95,6 +96,20 @@ fn install_client(ClientOpt::VsCode: ClientOpt) -> Result<()> {
95 96
96 Cmd { unix: r"npm install", windows: r"cmd.exe /c npm install", work_dir: "./editors/code" } 97 Cmd { unix: r"npm install", windows: r"cmd.exe /c npm install", work_dir: "./editors/code" }
97 .run()?; 98 .run()?;
99
100 let vsixes = || {
101 WalkDir::new("./editors/code")
102 .max_depth(1)
103 .into_iter()
104 .map(|it| it.unwrap())
105 .map(|it| it.path().to_owned())
106 .filter(|it| it.file_name().unwrap_or_default().to_string_lossy().ends_with(".vsix"))
107 };
108
109 for path in vsixes() {
110 fs::remove_file(path)?
111 }
112
98 Cmd { 113 Cmd {
99 unix: r"npm run package --scripts-prepend-node-path", 114 unix: r"npm run package --scripts-prepend-node-path",
100 windows: r"cmd.exe /c npm run package", 115 windows: r"cmd.exe /c npm run package",
@@ -102,6 +117,8 @@ fn install_client(ClientOpt::VsCode: ClientOpt) -> Result<()> {
102 } 117 }
103 .run()?; 118 .run()?;
104 119
120 let extension = vsixes().next().unwrap().file_name().unwrap().to_string_lossy().to_string();
121
105 let code_binary = ["code", "code-insiders", "codium", "code-oss"] 122 let code_binary = ["code", "code-insiders", "codium", "code-oss"]
106 .iter() 123 .iter()
107 .find(|bin| { 124 .find(|bin| {
@@ -118,10 +135,10 @@ fn install_client(ClientOpt::VsCode: ClientOpt) -> Result<()> {
118 })?; 135 })?;
119 136
120 Cmd { 137 Cmd {
121 unix: &format!(r"{} --install-extension ./rust-analyzer-0.1.0.vsix --force", code_binary), 138 unix: &format!(r"{} --install-extension ./{} --force", code_binary, extension),
122 windows: &format!( 139 windows: &format!(
123 r"cmd.exe /c {}.cmd --install-extension ./rust-analyzer-0.1.0.vsix --force", 140 r"cmd.exe /c {}.cmd --install-extension ./{} --force",
124 code_binary 141 code_binary, extension
125 ), 142 ),
126 work_dir: "./editors/code", 143 work_dir: "./editors/code",
127 } 144 }