aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_assists/src/ast_editor.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_assists/src/ast_editor.rs')
-rw-r--r--crates/ra_assists/src/ast_editor.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/crates/ra_assists/src/ast_editor.rs b/crates/ra_assists/src/ast_editor.rs
index aa7aeaabb..9afcac01a 100644
--- a/crates/ra_assists/src/ast_editor.rs
+++ b/crates/ra_assists/src/ast_editor.rs
@@ -2,7 +2,7 @@ use std::{iter, ops::RangeInclusive};
2 2
3use arrayvec::ArrayVec; 3use arrayvec::ArrayVec;
4use ra_text_edit::TextEditBuilder; 4use ra_text_edit::TextEditBuilder;
5use ra_syntax::{AstNode, TreeArc, ast, SyntaxKind::*, SyntaxElement, SourceFile, InsertPosition, Direction}; 5use ra_syntax::{AstNode, TreeArc, ast, SyntaxKind::*, SyntaxElement, SourceFile, InsertPosition, Direction, T};
6use ra_fmt::leading_indent; 6use ra_fmt::leading_indent;
7use hir::Name; 7use hir::Name;
8 8
@@ -49,7 +49,7 @@ impl<N: AstNode> AstEditor<N> {
49 49
50 fn do_make_multiline(&mut self) { 50 fn do_make_multiline(&mut self) {
51 let l_curly = 51 let l_curly =
52 match self.ast().syntax().children_with_tokens().find(|it| it.kind() == L_CURLY) { 52 match self.ast().syntax().children_with_tokens().find(|it| it.kind() == T!['{']) {
53 Some(it) => it, 53 Some(it) => it,
54 None => return, 54 None => return,
55 }; 55 };
@@ -124,7 +124,7 @@ impl AstEditor<ast::NamedFieldList> {
124 if let Some(comma) = $anchor 124 if let Some(comma) = $anchor
125 .syntax() 125 .syntax()
126 .siblings_with_tokens(Direction::Next) 126 .siblings_with_tokens(Direction::Next)
127 .find(|it| it.kind() == COMMA) 127 .find(|it| it.kind() == T![,])
128 { 128 {
129 InsertPosition::After(comma) 129 InsertPosition::After(comma)
130 } else { 130 } else {
@@ -154,7 +154,7 @@ impl AstEditor<ast::NamedFieldList> {
154 } 154 }
155 155
156 fn l_curly(&self) -> Option<SyntaxElement> { 156 fn l_curly(&self) -> Option<SyntaxElement> {
157 self.ast().syntax().children_with_tokens().find(|it| it.kind() == L_CURLY) 157 self.ast().syntax().children_with_tokens().find(|it| it.kind() == T!['{'])
158 } 158 }
159} 159}
160 160
@@ -188,7 +188,7 @@ impl AstEditor<ast::ItemList> {
188 } 188 }
189 189
190 fn l_curly(&self) -> Option<SyntaxElement> { 190 fn l_curly(&self) -> Option<SyntaxElement> {
191 self.ast().syntax().children_with_tokens().find(|it| it.kind() == L_CURLY) 191 self.ast().syntax().children_with_tokens().find(|it| it.kind() == T!['{'])
192 } 192 }
193} 193}
194 194
@@ -290,7 +290,7 @@ fn ast_node_from_file_text<N: AstNode>(text: &str) -> TreeArc<N> {
290 290
291mod tokens { 291mod tokens {
292 use once_cell::sync::Lazy; 292 use once_cell::sync::Lazy;
293 use ra_syntax::{AstNode, SourceFile, TreeArc, SyntaxToken, SyntaxKind::*}; 293 use ra_syntax::{AstNode, SourceFile, TreeArc, SyntaxToken, SyntaxKind::*, T};
294 294
295 static SOURCE_FILE: Lazy<TreeArc<SourceFile>> = Lazy::new(|| SourceFile::parse(",\n; ;")); 295 static SOURCE_FILE: Lazy<TreeArc<SourceFile>> = Lazy::new(|| SourceFile::parse(",\n; ;"));
296 296
@@ -299,7 +299,7 @@ mod tokens {
299 .syntax() 299 .syntax()
300 .descendants_with_tokens() 300 .descendants_with_tokens()
301 .filter_map(|it| it.as_token()) 301 .filter_map(|it| it.as_token())
302 .find(|it| it.kind() == COMMA) 302 .find(|it| it.kind() == T![,])
303 .unwrap() 303 .unwrap()
304 } 304 }
305 305