Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move comment before #776

Open
xenoterracide opened this issue Mar 28, 2024 · 4 comments
Open

move comment before #776

xenoterracide opened this issue Mar 28, 2024 · 4 comments

Comments

@xenoterracide
Copy link

xenoterracide commented Mar 28, 2024

given

    <module name="IllegalImport" /><!-- defaults to sun.* packages -->

I would like the reformat to be

    <!-- defaults to sun.* packages -->
    <module name="IllegalImport" />

instead of

    <module name="IllegalImport" />
    <!-- defaults to sun.* packages -->

note: obviously I've turned off whitespace sensitivity.

I feel like this would be a sensible default with whitespace sensitivity turned off, but an option would be nice too. I feel like programming convention is, comments to the right affect code to the left. Comments before affect code below. So moving the comment to be after changes the ... semantics.

Alternative, or maybe in addition to, if you could leave the comment alone if it's not making the line too long.

@fbridault
Copy link

I would also love that...

Even better, if I could make a wish, ideally, by default, move it on top and optionally, preserve it as it is.

@kddnewton
Copy link
Member

I'm not going to make a configuration option for this, but I am open to changing the default behavior here. Are we okay with saying that:

<foo /><!-- bar -->

gets reformatted to:

<!-- bar -->
<foo />

but

<foo /> <!-- bar -->

stays the same? As in, they have to be "touching" in order to get this special behavior?

@fbridault
Copy link

Thank you for your answer.
Yes, for me that would look perfectly acceptable!

@xenoterracide
Copy link
Author

Works for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants