diff options
Diffstat (limited to 'crates/libeditor/src/lib.rs')
-rw-r--r-- | crates/libeditor/src/lib.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/crates/libeditor/src/lib.rs b/crates/libeditor/src/lib.rs index 681cca81d..a6e6deba7 100644 --- a/crates/libeditor/src/lib.rs +++ b/crates/libeditor/src/lib.rs | |||
@@ -14,7 +14,7 @@ use libsyntax2::{ | |||
14 | algo::{walk, find_leaf_at_offset}, | 14 | algo::{walk, find_leaf_at_offset}, |
15 | SyntaxKind::{self, *}, | 15 | SyntaxKind::{self, *}, |
16 | }; | 16 | }; |
17 | pub use libsyntax2::{ParsedFile, TextRange, TextUnit}; | 17 | pub use libsyntax2::{File, TextRange, TextUnit}; |
18 | pub use self::{ | 18 | pub use self::{ |
19 | line_index::{LineIndex, LineCol}, | 19 | line_index::{LineIndex, LineCol}, |
20 | extend_selection::extend_selection, | 20 | extend_selection::extend_selection, |
@@ -51,11 +51,11 @@ pub enum RunnableKind { | |||
51 | Bin, | 51 | Bin, |
52 | } | 52 | } |
53 | 53 | ||
54 | pub fn parse(text: &str) -> ParsedFile { | 54 | pub fn parse(text: &str) -> File { |
55 | ParsedFile::parse(text) | 55 | File::parse(text) |
56 | } | 56 | } |
57 | 57 | ||
58 | pub fn matching_brace(file: &ParsedFile, offset: TextUnit) -> Option<TextUnit> { | 58 | pub fn matching_brace(file: &File, offset: TextUnit) -> Option<TextUnit> { |
59 | const BRACES: &[SyntaxKind] = &[ | 59 | const BRACES: &[SyntaxKind] = &[ |
60 | L_CURLY, R_CURLY, | 60 | L_CURLY, R_CURLY, |
61 | L_BRACK, R_BRACK, | 61 | L_BRACK, R_BRACK, |
@@ -75,7 +75,7 @@ pub fn matching_brace(file: &ParsedFile, offset: TextUnit) -> Option<TextUnit> { | |||
75 | Some(matching_node.range().start()) | 75 | Some(matching_node.range().start()) |
76 | } | 76 | } |
77 | 77 | ||
78 | pub fn highlight(file: &ParsedFile) -> Vec<HighlightedRange> { | 78 | pub fn highlight(file: &File) -> Vec<HighlightedRange> { |
79 | let mut res = Vec::new(); | 79 | let mut res = Vec::new(); |
80 | for node in walk::preorder(file.syntax()) { | 80 | for node in walk::preorder(file.syntax()) { |
81 | let tag = match node.kind() { | 81 | let tag = match node.kind() { |
@@ -98,7 +98,7 @@ pub fn highlight(file: &ParsedFile) -> Vec<HighlightedRange> { | |||
98 | res | 98 | res |
99 | } | 99 | } |
100 | 100 | ||
101 | pub fn diagnostics(file: &ParsedFile) -> Vec<Diagnostic> { | 101 | pub fn diagnostics(file: &File) -> Vec<Diagnostic> { |
102 | let mut res = Vec::new(); | 102 | let mut res = Vec::new(); |
103 | 103 | ||
104 | for node in walk::preorder(file.syntax()) { | 104 | for node in walk::preorder(file.syntax()) { |
@@ -116,11 +116,11 @@ pub fn diagnostics(file: &ParsedFile) -> Vec<Diagnostic> { | |||
116 | res | 116 | res |
117 | } | 117 | } |
118 | 118 | ||
119 | pub fn syntax_tree(file: &ParsedFile) -> String { | 119 | pub fn syntax_tree(file: &File) -> String { |
120 | ::libsyntax2::utils::dump_tree(file.syntax()) | 120 | ::libsyntax2::utils::dump_tree(file.syntax()) |
121 | } | 121 | } |
122 | 122 | ||
123 | pub fn runnables(file: &ParsedFile) -> Vec<Runnable> { | 123 | pub fn runnables(file: &File) -> Vec<Runnable> { |
124 | file.ast() | 124 | file.ast() |
125 | .functions() | 125 | .functions() |
126 | .filter_map(|f| { | 126 | .filter_map(|f| { |