diff options
author | Aleksey Kladov <[email protected]> | 2019-01-07 14:06:54 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-01-08 08:20:15 +0000 |
commit | d6020f516f2826dac7188171241e9a72d6248cf8 (patch) | |
tree | 66af2105c844056ced8a4f8b4157073117c8546f /crates/ra_cli/src | |
parent | fe53b282500f32c2d0cc1dfee1d7ccddfedac583 (diff) |
migrate ra_cli to new rowan
Diffstat (limited to 'crates/ra_cli/src')
-rw-r--r-- | crates/ra_cli/src/main.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/crates/ra_cli/src/main.rs b/crates/ra_cli/src/main.rs index a3b856aa9..0d12f3a88 100644 --- a/crates/ra_cli/src/main.rs +++ b/crates/ra_cli/src/main.rs | |||
@@ -3,7 +3,7 @@ use std::{fs, io::Read, path::Path, time::Instant}; | |||
3 | use clap::{App, Arg, SubCommand}; | 3 | use clap::{App, Arg, SubCommand}; |
4 | use join_to_string::join; | 4 | use join_to_string::join; |
5 | use ra_editor::{extend_selection, file_structure, syntax_tree}; | 5 | use ra_editor::{extend_selection, file_structure, syntax_tree}; |
6 | use ra_syntax::{SourceFileNode, TextRange}; | 6 | use ra_syntax::{SourceFile, TextRange, TreePtr, AstNode}; |
7 | use tools::collect_tests; | 7 | use tools::collect_tests; |
8 | 8 | ||
9 | type Result<T> = ::std::result::Result<T, failure::Error>; | 9 | type Result<T> = ::std::result::Result<T, failure::Error>; |
@@ -71,9 +71,9 @@ fn main() -> Result<()> { | |||
71 | Ok(()) | 71 | Ok(()) |
72 | } | 72 | } |
73 | 73 | ||
74 | fn file() -> Result<SourceFileNode> { | 74 | fn file() -> Result<TreePtr<SourceFile>> { |
75 | let text = read_stdin()?; | 75 | let text = read_stdin()?; |
76 | Ok(SourceFileNode::parse(&text)) | 76 | Ok(SourceFile::parse(&text)) |
77 | } | 77 | } |
78 | 78 | ||
79 | fn read_stdin() -> Result<String> { | 79 | fn read_stdin() -> Result<String> { |
@@ -92,12 +92,12 @@ fn render_test(file: &Path, line: usize) -> Result<(String, String)> { | |||
92 | None => failure::bail!("No test found at line {} at {}", line, file.display()), | 92 | None => failure::bail!("No test found at line {} at {}", line, file.display()), |
93 | Some((_start_line, test)) => test, | 93 | Some((_start_line, test)) => test, |
94 | }; | 94 | }; |
95 | let file = SourceFileNode::parse(&test.text); | 95 | let file = SourceFile::parse(&test.text); |
96 | let tree = syntax_tree(&file); | 96 | let tree = syntax_tree(&file); |
97 | Ok((test.text, tree)) | 97 | Ok((test.text, tree)) |
98 | } | 98 | } |
99 | 99 | ||
100 | fn selections(file: &SourceFileNode, start: u32, end: u32) -> String { | 100 | fn selections(file: &SourceFile, start: u32, end: u32) -> String { |
101 | let mut ranges = Vec::new(); | 101 | let mut ranges = Vec::new(); |
102 | let mut cur = Some(TextRange::from_to((start - 1).into(), (end - 1).into())); | 102 | let mut cur = Some(TextRange::from_to((start - 1).into(), (end - 1).into())); |
103 | while let Some(r) = cur { | 103 | while let Some(r) = cur { |