mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-23 19:43:23 +00:00
migrate ra_cli to new rowan
This commit is contained in:
parent
fe53b28250
commit
d6020f516f
1 changed files with 5 additions and 5 deletions
|
@ -3,7 +3,7 @@ use std::{fs, io::Read, path::Path, time::Instant};
|
|||
use clap::{App, Arg, SubCommand};
|
||||
use join_to_string::join;
|
||||
use ra_editor::{extend_selection, file_structure, syntax_tree};
|
||||
use ra_syntax::{SourceFileNode, TextRange};
|
||||
use ra_syntax::{SourceFile, TextRange, TreePtr, AstNode};
|
||||
use tools::collect_tests;
|
||||
|
||||
type Result<T> = ::std::result::Result<T, failure::Error>;
|
||||
|
@ -71,9 +71,9 @@ fn main() -> Result<()> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn file() -> Result<SourceFileNode> {
|
||||
fn file() -> Result<TreePtr<SourceFile>> {
|
||||
let text = read_stdin()?;
|
||||
Ok(SourceFileNode::parse(&text))
|
||||
Ok(SourceFile::parse(&text))
|
||||
}
|
||||
|
||||
fn read_stdin() -> Result<String> {
|
||||
|
@ -92,12 +92,12 @@ fn render_test(file: &Path, line: usize) -> Result<(String, String)> {
|
|||
None => failure::bail!("No test found at line {} at {}", line, file.display()),
|
||||
Some((_start_line, test)) => test,
|
||||
};
|
||||
let file = SourceFileNode::parse(&test.text);
|
||||
let file = SourceFile::parse(&test.text);
|
||||
let tree = syntax_tree(&file);
|
||||
Ok((test.text, tree))
|
||||
}
|
||||
|
||||
fn selections(file: &SourceFileNode, start: u32, end: u32) -> String {
|
||||
fn selections(file: &SourceFile, start: u32, end: u32) -> String {
|
||||
let mut ranges = Vec::new();
|
||||
let mut cur = Some(TextRange::from_to((start - 1).into(), (end - 1).into()));
|
||||
while let Some(r) = cur {
|
||||
|
|
Loading…
Reference in a new issue