diff --git a/.cargo/config b/.cargo/config index 7903b919c6..0e9e0f3877 100644 --- a/.cargo/config +++ b/.cargo/config @@ -1,5 +1,7 @@ [alias] gen-kinds = "run --package tools -- gen-kinds" gen-tests = "run --package tools -- gen-tests" +install-code = "run --package tools -- install-code" + render-test = "run --package cli -- render-test" parse = "run --package cli -- parse" diff --git a/tools/Cargo.toml b/tools/Cargo.toml index 4fcddebf02..f9fee16f9a 100644 --- a/tools/Cargo.toml +++ b/tools/Cargo.toml @@ -11,3 +11,4 @@ itertools = "0.7.8" tera = "0.11" clap = "2.32.0" failure = "0.1.1" +commandspec = "0.10" diff --git a/tools/src/main.rs b/tools/src/main.rs index 7d7b2afc0c..84a0cf1b6e 100644 --- a/tools/src/main.rs +++ b/tools/src/main.rs @@ -5,6 +5,8 @@ extern crate ron; extern crate tera; extern crate walkdir; extern crate tools; +#[macro_use] +extern crate commandspec; use std::{collections::{HashSet, HashMap}, fs, path::Path}; use clap::{App, Arg, SubCommand}; @@ -29,8 +31,10 @@ fn main() -> Result<()> { ) .subcommand(SubCommand::with_name("gen-kinds")) .subcommand(SubCommand::with_name("gen-tests")) + .subcommand(SubCommand::with_name("install-code")) .get_matches(); match matches.subcommand() { + ("install-code", _) => install_code_extension()?, (name, Some(matches)) => run_gen_command(name, matches.is_present("verify"))?, _ => unreachable!(), } @@ -149,3 +153,19 @@ fn existing_tests(dir: &Path) -> Result> { } Ok(res) } + +fn install_code_extension() -> Result<()> { + execute!(r" +cd code +npm install + ")?; + execute!(r" +cd code +./node_modules/vsce/out/vsce package + ")?; + execute!(r" +cd code +code --install-extension ./libsyntax-rust-0.0.1.vsix + ")?; + Ok(()) +}