aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_cli/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_cli/src/main.rs')
-rw-r--r--crates/ra_cli/src/main.rs27
1 files changed, 12 insertions, 15 deletions
diff --git a/crates/ra_cli/src/main.rs b/crates/ra_cli/src/main.rs
index 11605cfd8..239d846b3 100644
--- a/crates/ra_cli/src/main.rs
+++ b/crates/ra_cli/src/main.rs
@@ -2,19 +2,17 @@ extern crate clap;
2#[macro_use] 2#[macro_use]
3extern crate failure; 3extern crate failure;
4extern crate join_to_string; 4extern crate join_to_string;
5extern crate ra_syntax;
6extern crate ra_editor; 5extern crate ra_editor;
6extern crate ra_syntax;
7extern crate tools; 7extern crate tools;
8 8
9use std::{ 9use std::{fs, io::Read, path::Path, time::Instant};
10 fs, io::Read, path::Path, 10
11 time::Instant
12};
13use clap::{App, Arg, SubCommand}; 11use clap::{App, Arg, SubCommand};
14use join_to_string::join; 12use join_to_string::join;
13use ra_editor::{extend_selection, file_structure, syntax_tree};
14use ra_syntax::{File, TextRange};
15use tools::collect_tests; 15use tools::collect_tests;
16use ra_syntax::{TextRange, File};
17use ra_editor::{syntax_tree, file_structure, extend_selection};
18 16
19type Result<T> = ::std::result::Result<T, failure::Error>; 17type Result<T> = ::std::result::Result<T, failure::Error>;
20 18
@@ -36,14 +34,12 @@ fn main() -> Result<()> {
36 .takes_value(true), 34 .takes_value(true),
37 ), 35 ),
38 ) 36 )
39 .subcommand( 37 .subcommand(SubCommand::with_name("parse").arg(Arg::with_name("no-dump").long("--no-dump")))
40 SubCommand::with_name("parse")
41 .arg(Arg::with_name("no-dump").long("--no-dump"))
42 )
43 .subcommand(SubCommand::with_name("symbols")) 38 .subcommand(SubCommand::with_name("symbols"))
44 .subcommand(SubCommand::with_name("extend-selection") 39 .subcommand(
45 .arg(Arg::with_name("start")) 40 SubCommand::with_name("extend-selection")
46 .arg(Arg::with_name("end")) 41 .arg(Arg::with_name("start"))
42 .arg(Arg::with_name("end")),
47 ) 43 )
48 .get_matches(); 44 .get_matches();
49 match matches.subcommand() { 45 match matches.subcommand() {
@@ -116,7 +112,8 @@ fn selections(file: &File, start: u32, end: u32) -> String {
116 ranges.push(r); 112 ranges.push(r);
117 cur = extend_selection(&file, r); 113 cur = extend_selection(&file, r);
118 } 114 }
119 let ranges = ranges.iter() 115 let ranges = ranges
116 .iter()
120 .map(|r| (1 + u32::from(r.start()), 1 + u32::from(r.end()))) 117 .map(|r| (1 + u32::from(r.start()), 1 + u32::from(r.end())))
121 .map(|(s, e)| format!("({} {})", s, e)); 118 .map(|(s, e)| format!("({} {})", s, e));
122 join(ranges) 119 join(ranges)