mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-13 05:38:46 +00:00
Prevent auto-update of dev extension
This commit is contained in:
parent
52dcf3243e
commit
bd3a41cc33
3 changed files with 24 additions and 6 deletions
2
editors/code/package-lock.json
generated
2
editors/code/package-lock.json
generated
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "rust-analyzer",
|
"name": "rust-analyzer",
|
||||||
"version": "0.1.0",
|
"version": "0.2.0-dev",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
|
@ -5,7 +5,8 @@
|
||||||
"preview": true,
|
"preview": true,
|
||||||
"private": true,
|
"private": true,
|
||||||
"icon": "icon.png",
|
"icon": "icon.png",
|
||||||
"version": "0.1.0",
|
"//": "The real version is in release.yaml, this one just needs to be bigger",
|
||||||
|
"version": "0.2.0-dev",
|
||||||
"publisher": "matklad",
|
"publisher": "matklad",
|
||||||
"repository": {
|
"repository": {
|
||||||
"url": "https://github.com/rust-analyzer/rust-analyzer.git",
|
"url": "https://github.com/rust-analyzer/rust-analyzer.git",
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
//! Installs rust-analyzer language server and/or editor plugin.
|
//! Installs rust-analyzer language server and/or editor plugin.
|
||||||
|
|
||||||
use std::{env, path::PathBuf, str};
|
use std::{env, fs, path::PathBuf, str};
|
||||||
|
|
||||||
use anyhow::{bail, format_err, Context, Result};
|
use anyhow::{bail, format_err, Context, Result};
|
||||||
|
use walkdir::WalkDir;
|
||||||
|
|
||||||
use crate::cmd::{run, run_with_output, Cmd};
|
use crate::cmd::{run, run_with_output, Cmd};
|
||||||
|
|
||||||
|
@ -95,6 +96,20 @@ fn install_client(ClientOpt::VsCode: ClientOpt) -> Result<()> {
|
||||||
|
|
||||||
Cmd { unix: r"npm install", windows: r"cmd.exe /c npm install", work_dir: "./editors/code" }
|
Cmd { unix: r"npm install", windows: r"cmd.exe /c npm install", work_dir: "./editors/code" }
|
||||||
.run()?;
|
.run()?;
|
||||||
|
|
||||||
|
let vsixes = || {
|
||||||
|
WalkDir::new("./editors/code")
|
||||||
|
.max_depth(1)
|
||||||
|
.into_iter()
|
||||||
|
.map(|it| it.unwrap())
|
||||||
|
.map(|it| it.path().to_owned())
|
||||||
|
.filter(|it| it.file_name().unwrap_or_default().to_string_lossy().ends_with(".vsix"))
|
||||||
|
};
|
||||||
|
|
||||||
|
for path in vsixes() {
|
||||||
|
fs::remove_file(path)?
|
||||||
|
}
|
||||||
|
|
||||||
Cmd {
|
Cmd {
|
||||||
unix: r"npm run package --scripts-prepend-node-path",
|
unix: r"npm run package --scripts-prepend-node-path",
|
||||||
windows: r"cmd.exe /c npm run package",
|
windows: r"cmd.exe /c npm run package",
|
||||||
|
@ -102,6 +117,8 @@ fn install_client(ClientOpt::VsCode: ClientOpt) -> Result<()> {
|
||||||
}
|
}
|
||||||
.run()?;
|
.run()?;
|
||||||
|
|
||||||
|
let extension = vsixes().next().unwrap().file_name().unwrap().to_string_lossy().to_string();
|
||||||
|
|
||||||
let code_binary = ["code", "code-insiders", "codium", "code-oss"]
|
let code_binary = ["code", "code-insiders", "codium", "code-oss"]
|
||||||
.iter()
|
.iter()
|
||||||
.find(|bin| {
|
.find(|bin| {
|
||||||
|
@ -118,10 +135,10 @@ fn install_client(ClientOpt::VsCode: ClientOpt) -> Result<()> {
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
Cmd {
|
Cmd {
|
||||||
unix: &format!(r"{} --install-extension ./rust-analyzer-0.1.0.vsix --force", code_binary),
|
unix: &format!(r"{} --install-extension ./{} --force", code_binary, extension),
|
||||||
windows: &format!(
|
windows: &format!(
|
||||||
r"cmd.exe /c {}.cmd --install-extension ./rust-analyzer-0.1.0.vsix --force",
|
r"cmd.exe /c {}.cmd --install-extension ./{} --force",
|
||||||
code_binary
|
code_binary, extension
|
||||||
),
|
),
|
||||||
work_dir: "./editors/code",
|
work_dir: "./editors/code",
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue