Skip to content

[Feature request] Vertical formatting for attributes #5646

@blyxyas

Description

@blyxyas
Member

Hi, it would be really cool if an attribute's content could be arranged in more ways. (Similar to array_width)

Example:

Currently, if you have this attribute:

#[diagnostic(
    code(...),
    url(...),
    severity(...)
)]
fn x() {...}

It will get rearranged to:

#[diagnostic(code(...), url(...), severity(...))]
fn x() {...}

It would be useful if there was an option specifically for vertical formatting in attributes' content

Activity

ytmimi

ytmimi commented on Dec 30, 2022

@ytmimi
Contributor

Hey @blyxyas thanks for reaching out.

A lot of the work needed to implement this feature is currently being added in #5337. Once that PR lands this should be fairly straightforward to implement, but until then let's keep this on hold.

In the meantime you might try to see if you can use attr_fn_like_width to achieve the formatting you're looking for

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @ytmimi@blyxyas

        Issue actions

          [Feature request] Vertical formatting for attributes · Issue #5646 · rust-lang/rustfmt