mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-11-26 13:51:55 +00:00
9600: fix: Single-line and nested blocks in the `unwrap_block` assist r=Veykril a=patrick-gu Fixes #8411 Rework the system for stripping whitespace and braces in the unwrap_block assist to allow correct unwrapping of blocks such as: ```rust { $0 0 } ``` into ```rust 0 ``` and nested blocks, such as: ```rust $0{ { 3 } } ``` into ```rust { 3 } ``` This is done by creating the `update_expr_string_with_pat` function (along with `update_expr_string` and `update_expr_string_without_newline`), which strips whitespace and braces in a way that ensures that only whitespace and a maximum of one brace are removed from the start and end of the expression string. I have also created several tests to ensure that this functionality works correctly. Co-authored-by: patrick-gu <55641350+patrick-gu@users.noreply.github.com> |
||
|---|---|---|
| .. | ||
| base_db | ||
| cfg | ||
| flycheck | ||
| hir | ||
| hir_def | ||
| hir_expand | ||
| hir_ty | ||
| ide | ||
| ide_assists | ||
| ide_completion | ||
| ide_db | ||
| ide_diagnostics | ||
| ide_ssr | ||
| mbe | ||
| parser | ||
| paths | ||
| proc_macro_api | ||
| proc_macro_srv | ||
| proc_macro_test | ||
| profile | ||
| project_model | ||
| rust-analyzer | ||
| sourcegen | ||
| stdx | ||
| syntax | ||
| test_utils | ||
| text_edit | ||
| toolchain | ||
| tt | ||
| vfs | ||
| vfs-notify | ||