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

Inline parameter comments may be wrapped to wrong line #561

Closed
tonycuadra opened this issue Sep 2, 2022 · 4 comments · Fixed by #549
Closed

Inline parameter comments may be wrapped to wrong line #561

tonycuadra opened this issue Sep 2, 2022 · 4 comments · Fixed by #549
Labels
enhancement New feature or request

Comments

@tonycuadra
Copy link

For example, this:

self:doTheThing(what, --[[rightAway = ]] true)

Is rewritten by Stylua to:

self:doTheThing(
    what, --[[rightAway = ]]
    true
)

It would be preferable to distinguish these short inline parameter comments and not wrap at all.

@JohnnyMorganz
Copy link
Owner

I was just thinking the exact same thing in #543 and tried implementing it, but it caused some negative regressions for other repos shown in #549, so I decided against it.

If you have a better rule to apply I'm more than happy to look into it, but it's unfortunate that we cannot do this as-is. (Ideally the comments should've been single line comments in the offending repos, and this would be fine, but that's not something we can control, and I imagine there are other repos which do this too)

@JohnnyMorganz
Copy link
Owner

Coming back to this, I just realised the diffs in #549 (comment) are actually incorrect. These are applied after initially formatting stylua using main branch, then using the PR changes.

It actually won't be as bad as that, since looking at the original code it was already inlined. We should be able to do this

@JohnnyMorganz
Copy link
Owner

I've fixed the large scale testing diffs, and it shows that this isn't actually a bad change: #549 (comment)

I think its reasonable to add this in #549

cc @matthargett

@tonycuadra
Copy link
Author

Excellent! Thanks

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

Successfully merging a pull request may close this issue.

2 participants