File tree 1 file changed +19
-0
lines changed
src/tools/rust-analyzer/crates/ide/src
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(
174
174
kinds : & [ fn ( SyntaxKind ) -> bool ] ,
175
175
) -> Option < TextEdit > {
176
176
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
+ }
177
180
let ( filter, node) = t
178
181
. parent_ancestors ( )
179
182
. take_while ( |n| n. text_range ( ) . start ( ) == offset)
@@ -1091,6 +1094,22 @@ fn f() {
1091
1094
) ;
1092
1095
}
1093
1096
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
+
1094
1113
#[ test]
1095
1114
fn adds_closing_parenthesis_for_pat ( ) {
1096
1115
type_char (
You can’t perform that action at this time.
0 commit comments