]> git.lizzy.rs Git - rust.git/blobdiff - crates/rust-analyzer/src/cli.rs
Replaced fold with for loop
[rust.git] / crates / rust-analyzer / src / cli.rs
index 2f65a1dad07f2792591707bb607c81e1b8a2a29c..6ccdaa86dd628786d33a9142e3b199f2dbd5bfa2 100644 (file)
@@ -1,24 +1,23 @@
 //! Various batch processing tasks, intended primarily for debugging.
 
+pub mod flags;
 pub mod load_cargo;
+mod parse;
+mod symbols;
+mod highlight;
 mod analysis_stats;
 mod diagnostics;
-mod progress_report;
 mod ssr;
+mod lsif;
+
+mod progress_report;
 
 use std::io::Read;
 
 use anyhow::Result;
-use ide::{Analysis, AnalysisHost};
-use syntax::{AstNode, SourceFile};
+use ide::AnalysisHost;
 use vfs::Vfs;
 
-pub use self::{
-    analysis_stats::AnalysisStatsCmd,
-    diagnostics::diagnostics,
-    ssr::{apply_ssr_rules, search_for_patterns},
-};
-
 #[derive(Clone, Copy)]
 pub enum Verbosity {
     Spammy,
@@ -36,38 +35,6 @@ pub fn is_spammy(self) -> bool {
     }
 }
 
-pub fn parse(no_dump: bool) -> Result<()> {
-    let _p = profile::span("parsing");
-    let file = file()?;
-    if !no_dump {
-        println!("{:#?}", file.syntax());
-    }
-    std::mem::forget(file);
-    Ok(())
-}
-
-pub fn symbols() -> Result<()> {
-    let text = read_stdin()?;
-    let (analysis, file_id) = Analysis::from_single_file(text);
-    let structure = analysis.file_structure(file_id).unwrap();
-    for s in structure {
-        println!("{:?}", s);
-    }
-    Ok(())
-}
-
-pub fn highlight(rainbow: bool) -> Result<()> {
-    let (analysis, file_id) = Analysis::from_single_file(read_stdin()?);
-    let html = analysis.highlight_as_html(file_id, rainbow).unwrap();
-    println!("{}", html);
-    Ok(())
-}
-
-fn file() -> Result<SourceFile> {
-    let text = read_stdin()?;
-    Ok(SourceFile::parse(&text).tree())
-}
-
 fn read_stdin() -> Result<String> {
     let mut buff = String::new();
     std::io::stdin().read_to_string(&mut buff)?;