AndrewRadev/splitjoin.vim

Option to put Rust attributes in a separate line when splitting

z33ky opened this issue · 3 comments

z33ky commented

I would like to request an option to put attributes in the preceding line when splitting.
Here's what I mean:

struct Foo { #[attr] member: u32 }
//turns into
struct Foo {
    #[attr] member: u32,
}
//desired
struct Foo {
    #[attr]
    member: u32,
}

I'd forgotten to deal with these attributes. They're definitely a complication, but I think I managed to implement some better handling for them.

Splitting should now work as with your example out of the box. I could add a setting for it, but to be honest, this seems like the standard style of writing these attributes in multiline definitions. I'd say if somebody opens an issue to request the inline #[attr] member: u32 style after splitting, I can add an option for that.

Does that make sense?

z33ky commented

Yes. I may have seen the former style a couple of times somewhere, but I'm not even sure.
I can also confirm that it works as desired in the latest commit.

In that case, I'll go ahead and close the issue. Let me know if you run into any related problems.