@@ -2,7 +2,7 @@ use std::{iter, ops::RangeInclusive};
2
2
3
3
use arrayvec:: ArrayVec ;
4
4
use ra_text_edit:: TextEditBuilder ;
5
- use ra_syntax:: { AstNode , TreeArc , ast, SyntaxKind :: * , SyntaxElement , SourceFile , InsertPosition , Direction } ;
5
+ use ra_syntax:: { AstNode , TreeArc , ast, SyntaxKind :: * , SyntaxElement , SourceFile , InsertPosition , Direction , T } ;
6
6
use ra_fmt:: leading_indent;
7
7
use hir:: Name ;
8
8
@@ -49,7 +49,7 @@ impl<N: AstNode> AstEditor<N> {
49
49
50
50
fn do_make_multiline ( & mut self ) {
51
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
53
Some ( it) => it,
54
54
None => return ,
55
55
} ;
@@ -124,7 +124,7 @@ impl AstEditor<ast::NamedFieldList> {
124
124
if let Some ( comma) = $anchor
125
125
. syntax( )
126
126
. siblings_with_tokens( Direction :: Next )
127
- . find( |it| it. kind( ) == COMMA )
127
+ . find( |it| it. kind( ) == T ! [ , ] )
128
128
{
129
129
InsertPosition :: After ( comma)
130
130
} else {
@@ -154,7 +154,7 @@ impl AstEditor<ast::NamedFieldList> {
154
154
}
155
155
156
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
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
291
291
mod tokens {
292
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
295
static SOURCE_FILE : Lazy < TreeArc < SourceFile > > = Lazy :: new ( || SourceFile :: parse ( ",\n ; ;" ) ) ;
296
296
@@ -299,7 +299,7 @@ mod tokens {
299
299
. syntax ( )
300
300
. descendants_with_tokens ( )
301
301
. filter_map ( |it| it. as_token ( ) )
302
- . find ( |it| it. kind ( ) == COMMA )
302
+ . find ( |it| it. kind ( ) == T ! [ , ] )
303
303
. unwrap ( )
304
304
}
305
305
0 commit comments