ra_ap_rust_analyzer/cli/
symbols.rs

1//! Read Rust code on stdin, print syntax tree on stdout.
2use ide::Analysis;
3
4use crate::cli::{flags, read_stdin};
5
6impl flags::Symbols {
7    pub fn run(self) -> anyhow::Result<()> {
8        let text = read_stdin()?;
9        let (analysis, file_id) = Analysis::from_single_file(text);
10        let structure = analysis.file_structure(file_id).unwrap();
11        for s in structure {
12            println!("{s:?}");
13        }
14        Ok(())
15    }
16}