feat: support VSCodium (#788)
This commit is contained in:
@@ -163,6 +163,7 @@ pub enum Step {
|
|||||||
Vim,
|
Vim,
|
||||||
VoltaPackages,
|
VoltaPackages,
|
||||||
Vscode,
|
Vscode,
|
||||||
|
Vscodium,
|
||||||
Waydroid,
|
Waydroid,
|
||||||
Winget,
|
Winget,
|
||||||
Wsl,
|
Wsl,
|
||||||
|
|||||||
@@ -372,6 +372,9 @@ fn run() -> Result<()> {
|
|||||||
runner.execute(Step::Vscode, "Visual Studio Code extensions", || {
|
runner.execute(Step::Vscode, "Visual Studio Code extensions", || {
|
||||||
generic::run_vscode_extensions_update(&ctx)
|
generic::run_vscode_extensions_update(&ctx)
|
||||||
})?;
|
})?;
|
||||||
|
runner.execute(Step::Vscodium, "VSCodium extensions", || {
|
||||||
|
generic::run_vscodium_extensions_update(&ctx)
|
||||||
|
})?;
|
||||||
runner.execute(Step::Conda, "conda", || generic::run_conda_update(&ctx))?;
|
runner.execute(Step::Conda, "conda", || generic::run_conda_update(&ctx))?;
|
||||||
runner.execute(Step::Mamba, "mamba", || generic::run_mamba_update(&ctx))?;
|
runner.execute(Step::Mamba, "mamba", || generic::run_mamba_update(&ctx))?;
|
||||||
runner.execute(Step::Pixi, "pixi", || generic::run_pixi_update(&ctx))?;
|
runner.execute(Step::Pixi, "pixi", || generic::run_pixi_update(&ctx))?;
|
||||||
|
|||||||
@@ -400,6 +400,48 @@ pub fn run_vcpkg_update(ctx: &ExecutionContext) -> Result<()> {
|
|||||||
command.args(["upgrade", "--no-dry-run"]).status_checked()
|
command.args(["upgrade", "--no-dry-run"]).status_checked()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Make VSCodium a separate step because:
|
||||||
|
///
|
||||||
|
/// 1. Users could use both VSCode and VSCoium
|
||||||
|
/// 2. Just in case, VSCodium could have incompatible changes with VSCode
|
||||||
|
pub fn run_vscodium_extensions_update(ctx: &ExecutionContext) -> Result<()> {
|
||||||
|
// Calling vscodoe in WSL may install a server instead of updating extensions (https://github.com/topgrade-rs/topgrade/issues/594#issuecomment-1782157367)
|
||||||
|
if is_wsl()? {
|
||||||
|
return Err(SkipStep(String::from("Should not run in WSL")).into());
|
||||||
|
}
|
||||||
|
|
||||||
|
let vscodium = require("codium")?;
|
||||||
|
|
||||||
|
// VSCode has update command only since 1.86 version ("january 2024" update), disable the update for prior versions
|
||||||
|
// Use command `code --version` which returns 3 lines: version, git commit, instruction set. We parse only the first one
|
||||||
|
//
|
||||||
|
// This should apply to VSCodium as well.
|
||||||
|
let version: Result<Version> = match Command::new(&vscodium)
|
||||||
|
.arg("--version")
|
||||||
|
.output_checked_utf8()?
|
||||||
|
.stdout
|
||||||
|
.lines()
|
||||||
|
.next()
|
||||||
|
{
|
||||||
|
Some(item) => Version::parse(item).map_err(|err| err.into()),
|
||||||
|
_ => return Err(SkipStep(String::from("Cannot find vscodium version")).into()),
|
||||||
|
};
|
||||||
|
|
||||||
|
if !matches!(version, Ok(version) if version >= Version::new(1, 86, 0)) {
|
||||||
|
return Err(SkipStep(String::from(
|
||||||
|
"Too old vscodium version to have update extensions command",
|
||||||
|
))
|
||||||
|
.into());
|
||||||
|
}
|
||||||
|
|
||||||
|
print_separator("VSCodium extensions");
|
||||||
|
|
||||||
|
ctx.run_type()
|
||||||
|
.execute(vscodium)
|
||||||
|
.arg("--update-extensions")
|
||||||
|
.status_checked()
|
||||||
|
}
|
||||||
|
|
||||||
pub fn run_vscode_extensions_update(ctx: &ExecutionContext) -> Result<()> {
|
pub fn run_vscode_extensions_update(ctx: &ExecutionContext) -> Result<()> {
|
||||||
// Calling vscode in WSL may install a server instead of updating extensions (https://github.com/topgrade-rs/topgrade/issues/594#issuecomment-1782157367)
|
// Calling vscode in WSL may install a server instead of updating extensions (https://github.com/topgrade-rs/topgrade/issues/594#issuecomment-1782157367)
|
||||||
if is_wsl()? {
|
if is_wsl()? {
|
||||||
|
|||||||
Reference in New Issue
Block a user