File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
crates/assists/src/handlers Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -119,6 +119,7 @@ fn needs_parentheses_around_macro_contents(macro_contents: Vec<SyntaxElement>) -
119119 let symbol_not_in_bracket = unpaired_brackets_in_contents. is_empty ( ) ;
120120 if symbol_not_in_bracket
121121 && symbol_kind != SyntaxKind :: COLON
122+ && symbol_kind != SyntaxKind :: DOT
122123 && symbol_kind. is_punct ( )
123124 {
124125 return true ;
@@ -242,6 +243,25 @@ fn main() {
242243 check_assist ( remove_dbg, r#"let res = <|>dbg![2 + 2] * 5"# , r#"let res = (2 + 2) * 5"# ) ;
243244 }
244245
246+ #[ test]
247+ fn test_remove_dbg_method_chaining ( ) {
248+ check_assist (
249+ remove_dbg,
250+ r#"let res = <|>dbg!(foo().bar()).baz();"# ,
251+ r#"let res = foo().bar().baz();"# ,
252+ ) ;
253+ check_assist (
254+ remove_dbg,
255+ r#"let res = <|>dbg!(foo.bar()).baz();"# ,
256+ r#"let res = foo.bar().baz();"# ,
257+ ) ;
258+ }
259+
260+ #[ test]
261+ fn test_remove_dbg_field_chaining ( ) {
262+ check_assist ( remove_dbg, r#"let res = <|>dbg!(foo.bar).baz;"# , r#"let res = foo.bar.baz;"# ) ;
263+ }
264+
245265 #[ test]
246266 fn test_remove_dbg_from_inside_fn ( ) {
247267 check_assist_target (
You can’t perform that action at this time.
0 commit comments