diff options
Diffstat (limited to 'crates/ra_cli/src')
-rw-r--r-- | crates/ra_cli/src/main.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/crates/ra_cli/src/main.rs b/crates/ra_cli/src/main.rs index f11d0e6bd..93aba4c70 100644 --- a/crates/ra_cli/src/main.rs +++ b/crates/ra_cli/src/main.rs | |||
@@ -3,7 +3,7 @@ mod analysis_stats; | |||
3 | use std::io::Read; | 3 | use std::io::Read; |
4 | 4 | ||
5 | use clap::{App, Arg, SubCommand}; | 5 | use clap::{App, Arg, SubCommand}; |
6 | use ra_ide_api::file_structure; | 6 | use ra_ide_api::{file_structure, Analysis}; |
7 | use ra_syntax::{SourceFile, TreeArc, AstNode}; | 7 | use ra_syntax::{SourceFile, TreeArc, AstNode}; |
8 | use flexi_logger::Logger; | 8 | use flexi_logger::Logger; |
9 | use ra_prof::profile; | 9 | use ra_prof::profile; |
@@ -16,6 +16,7 @@ fn main() -> Result<()> { | |||
16 | .setting(clap::AppSettings::SubcommandRequiredElseHelp) | 16 | .setting(clap::AppSettings::SubcommandRequiredElseHelp) |
17 | .subcommand(SubCommand::with_name("parse").arg(Arg::with_name("no-dump").long("--no-dump"))) | 17 | .subcommand(SubCommand::with_name("parse").arg(Arg::with_name("no-dump").long("--no-dump"))) |
18 | .subcommand(SubCommand::with_name("symbols")) | 18 | .subcommand(SubCommand::with_name("symbols")) |
19 | .subcommand(SubCommand::with_name("highlight")) | ||
19 | .subcommand( | 20 | .subcommand( |
20 | SubCommand::with_name("analysis-stats") | 21 | SubCommand::with_name("analysis-stats") |
21 | .arg(Arg::with_name("verbose").short("v").long("verbose")) | 22 | .arg(Arg::with_name("verbose").short("v").long("verbose")) |
@@ -38,6 +39,11 @@ fn main() -> Result<()> { | |||
38 | println!("{:?}", s); | 39 | println!("{:?}", s); |
39 | } | 40 | } |
40 | } | 41 | } |
42 | ("highlight", _) => { | ||
43 | let (analysis, file_id) = Analysis::from_single_file(read_stdin()?); | ||
44 | let html = analysis.highlight_as_html(file_id).unwrap(); | ||
45 | println!("{}", html); | ||
46 | } | ||
41 | ("analysis-stats", Some(matches)) => { | 47 | ("analysis-stats", Some(matches)) => { |
42 | let verbose = matches.is_present("verbose"); | 48 | let verbose = matches.is_present("verbose"); |
43 | let path = matches.value_of("path").unwrap_or(""); | 49 | let path = matches.value_of("path").unwrap_or(""); |