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

meson format: removes leading spaces before method calls on their own lines #13567

Closed
dcbaker opened this issue Aug 19, 2024 · 1 comment · Fixed by #13580
Closed

meson format: removes leading spaces before method calls on their own lines #13567

dcbaker opened this issue Aug 19, 2024 · 1 comment · Fixed by #13580

Comments

@dcbaker
Copy link
Member

dcbaker commented Aug 19, 2024

Describe the bug
Mesa (and I suspect other projects that make heavy use of feature option methods, has a lot of code like this):

opt = get_option(...) \
  .enable_if(<some condition is met>, error_message : ...) \
  .enable_auto_if(<some other condition is met>) \
  .disable_if(<some final condition is met>, error_message : ...)

Meson format removes these leading spaces, making the code harder to read.

Expected behavior
I would prefer it to just leave the spaces alone. However, I know a heuristic to handle that might be difficult, so even an option like clang-format's // clang-format off/// clang-format on would be a nice step, and might be generally useful on it's own for other corner cases that meson format doesn't yet handle correctly.

system parameters
Meson 1.5.0 and master (cdf646f)

@annacrombie
Copy link
Contributor

annacrombie commented Aug 21, 2024

@dcbaker I'm gonna take black's stance on this and say that you should just wrap that whole thing in () so the formatter doesn't have to mess with line continuations. Also, muon fmt supports magic comments to enable / disable formatting, with # fmt: off and #fmt: on1 (in case you wanted to use the same syntax @bruchar1).

@dcbaker dcbaker closed this as completed in 37c5bff Sep 6, 2024
eli-schwartz pushed a commit that referenced this issue Sep 16, 2024
Fixes #13566. Fixes #13567.

(cherry picked from commit 37c5bff)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants