File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
src/tools/rust-analyzer/crates/ide/src Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -174,6 +174,9 @@ fn on_delimited_node_typed(
174174 kinds : & [ fn ( SyntaxKind ) -> bool ] ,
175175) -> Option < TextEdit > {
176176 let t = reparsed. syntax ( ) . token_at_offset ( offset) . right_biased ( ) ?;
177+ if t. prev_token ( ) . map_or ( false , |t| t. kind ( ) . is_any_identifier ( ) ) {
178+ return None ;
179+ }
177180 let ( filter, node) = t
178181 . parent_ancestors ( )
179182 . take_while ( |n| n. text_range ( ) . start ( ) == offset)
@@ -1091,6 +1094,22 @@ fn f() {
10911094 ) ;
10921095 }
10931096
1097+ #[ test]
1098+ fn preceding_whitespace_is_significant_for_closing_brackets ( ) {
1099+ type_char_noop (
1100+ '(' ,
1101+ r#"
1102+ fn f() { a.b$0if true {} }
1103+ "# ,
1104+ ) ;
1105+ type_char_noop (
1106+ '(' ,
1107+ r#"
1108+ fn f() { foo$0{} }
1109+ "# ,
1110+ ) ;
1111+ }
1112+
10941113 #[ test]
10951114 fn adds_closing_parenthesis_for_pat ( ) {
10961115 type_char (
You can’t perform that action at this time.
0 commit comments