you better run

This commit is contained in:
Aleksey Kladov 2018-08-27 22:52:43 +03:00
parent 5751815314
commit 422efe59af
13 changed files with 2654 additions and 2633 deletions

View file

@ -135,48 +135,6 @@ pub fn handle_code_action(
res.push(cmd);
}
}
for runnable in libeditor::runnables(&file) {
if !contains_offset_nonstrict(runnable.range, offset) {
continue;
}
#[derive(Serialize)]
struct ProcessSpec {
bin: String,
args: Vec<String>,
env: HashMap<String, String>,
}
let spec = ProcessSpec {
bin: "cargo".to_string(),
args: match runnable.kind {
libeditor::RunnableKind::Test { name } => {
vec![
"test".to_string(),
"--".to_string(),
name,
"--nocapture".to_string(),
]
}
libeditor::RunnableKind::Bin => vec!["run".to_string()]
},
env: {
let mut m = HashMap::new();
m.insert(
"RUST_BACKTRACE".to_string(),
"short".to_string(),
);
m
}
};
let cmd = Command {
title: "Run ...".to_string(),
command: "libsyntax-rust.run".to_string(),
arguments: Some(vec![to_value(spec).unwrap()]),
};
res.push(cmd);
}
for (diag, quick_fix) in world.analysis().diagnostics(file_id)? {
let quick_fix = match quick_fix {

View file

@ -142,7 +142,7 @@ pub enum Runnables {}
impl Request for Runnables {
type Params = RunnablesParams;
type Result = Vec<Runnable>;
const METHOD: &'static str = "m/joinLines";
const METHOD: &'static str = "m/runnables";
}
#[derive(Deserialize, Debug)]