Skip to content

Commit bd3a41c

Browse files
committed
Prevent auto-update of dev extension
1 parent 52dcf32 commit bd3a41c

File tree

3 files changed

+24
-6
lines changed

3 files changed

+24
-6
lines changed

editors/code/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

editors/code/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"preview": true,
66
"private": true,
77
"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",
910
"publisher": "matklad",
1011
"repository": {
1112
"url": "https://github.com/rust-analyzer/rust-analyzer.git",

xtask/src/install.rs

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
//! Installs rust-analyzer language server and/or editor plugin.
22
3-
use std::{env, path::PathBuf, str};
3+
use std::{env, fs, path::PathBuf, str};
44

55
use anyhow::{bail, format_err, Context, Result};
6+
use walkdir::WalkDir;
67

78
use crate::cmd::{run, run_with_output, Cmd};
89

@@ -95,13 +96,29 @@ fn install_client(ClientOpt::VsCode: ClientOpt) -> Result<()> {
9596

9697
Cmd { unix: r"npm install", windows: r"cmd.exe /c npm install", work_dir: "./editors/code" }
9798
.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+
98113
Cmd {
99114
unix: r"npm run package --scripts-prepend-node-path",
100115
windows: r"cmd.exe /c npm run package",
101116
work_dir: "./editors/code",
102117
}
103118
.run()?;
104119

120+
let extension = vsixes().next().unwrap().file_name().unwrap().to_string_lossy().to_string();
121+
105122
let code_binary = ["code", "code-insiders", "codium", "code-oss"]
106123
.iter()
107124
.find(|bin| {
@@ -118,10 +135,10 @@ fn install_client(ClientOpt::VsCode: ClientOpt) -> Result<()> {
118135
})?;
119136

120137
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),
122139
windows: &format!(
123-
r"cmd.exe /c {}.cmd --install-extension ./rust-analyzer-0.1.0.vsix --force",
124-
code_binary
140+
r"cmd.exe /c {}.cmd --install-extension ./{} --force",
141+
code_binary, extension
125142
),
126143
work_dir: "./editors/code",
127144
}

0 commit comments

Comments
 (0)