aboutsummaryrefslogtreecommitdiff
path: root/crates/libeditor/src/lib.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-08-25 09:44:58 +0100
committerAleksey Kladov <[email protected]>2018-08-25 09:44:58 +0100
commit220d285b4afb250e59a08e9b1ad38c2fc2275782 (patch)
treeab32fc8d58ee04fc5afae20bc80f02c6b2557a39 /crates/libeditor/src/lib.rs
parentcf278ed3bf71d336422f7d7d7d51be92b717b720 (diff)
rename ParsedFile -> File
Diffstat (limited to 'crates/libeditor/src/lib.rs')
-rw-r--r--crates/libeditor/src/lib.rs16
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};
17pub use libsyntax2::{ParsedFile, TextRange, TextUnit}; 17pub use libsyntax2::{File, TextRange, TextUnit};
18pub use self::{ 18pub 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
54pub fn parse(text: &str) -> ParsedFile { 54pub fn parse(text: &str) -> File {
55 ParsedFile::parse(text) 55 File::parse(text)
56} 56}
57 57
58pub fn matching_brace(file: &ParsedFile, offset: TextUnit) -> Option<TextUnit> { 58pub 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
78pub fn highlight(file: &ParsedFile) -> Vec<HighlightedRange> { 78pub 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
101pub fn diagnostics(file: &ParsedFile) -> Vec<Diagnostic> { 101pub 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
119pub fn syntax_tree(file: &ParsedFile) -> String { 119pub fn syntax_tree(file: &File) -> String {
120 ::libsyntax2::utils::dump_tree(file.syntax()) 120 ::libsyntax2::utils::dump_tree(file.syntax())
121} 121}
122 122
123pub fn runnables(file: &ParsedFile) -> Vec<Runnable> { 123pub fn runnables(file: &File) -> Vec<Runnable> {
124 file.ast() 124 file.ast()
125 .functions() 125 .functions()
126 .filter_map(|f| { 126 .filter_map(|f| {