mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
Auto merge of #14752 - ponyii:fix/generate_derive_breaks_indentation, r=Veykril
fix: assists no longer break indentation Fixes https://github.com/rust-lang/rust-analyzer/issues/14674 These are _ad hoc_ patches for a number of assists that can produce incorrectly indented code, namely: - generate_derive - add_missing_impl_members - add_missing_default_members Some general solution is required in future, as the same problem arises in many other assists, e.g. - replace_derive_with... - generate_default_from_enum... - generate_default_from_new - generate_delegate_methods (the list is incomplete)
This commit is contained in:
commit
a512774fd9
4 changed files with 217 additions and 10 deletions
|
@ -465,6 +465,8 @@ impl ast::Impl {
|
|||
}
|
||||
|
||||
impl ast::AssocItemList {
|
||||
/// Attention! This function does align the first line of `item` with respect to `self`,
|
||||
/// but it does _not_ change indentation of other lines (if any).
|
||||
pub fn add_item(&self, item: ast::AssocItem) {
|
||||
let (indent, position, whitespace) = match self.assoc_items().last() {
|
||||
Some(last_item) => (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue