-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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 #12318
Meson format #12318
Conversation
7972813
to
0df9d99
Compare
cc @JCWasmx86 |
Thanks for pinging me tristan957, I closed #10971 |
0302286
to
afaf13a
Compare
rebased, and targeted for 1.4.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few of these commits could use more detailed commit messages.
The first one I suspect (though I haven't checked) was originally only for keyword arguments so column made sense, and stopped making sense as we extended it to additional places.
Overall I like this a lot, and while there's some additional things I'd like to handle here, I think those are fine follow ons.
I t would be nice if meson format
would automatically load a meson.format
file that was at the root of the source directory so that proejcts could just run meson format
and not have to worry about passing in the format rules if they're defined globally
- Wrong types were used for MultilineStringNode and FormatMultilineStringNode - Simplify the `escape` method to avoid use of T.Cast
In #02ff955, I used the word `columns` instead of `colons`, but the meaning really was about the ':' symbol.
The `AstVisitor` intentionally ignores whitespaces and symbols, as they are not useful for tne interpreter. However, when formatting a build file, we need them. This commit introduces a `FullAstVisitor` that visits every Nodes, including whitespaces and symbols.
Use the new `FullAstVisitor` for `AstConditionLevel`. This will allow proper formatting of `if / else / endif` and `foreach / endforeach` blocks.
this will allow transforming string types in the formater
I tried to improve it. But I am open to suggestions...
Done. Will also automatically analyse meson.build in current directory if it is present and no other build files are specified on the command line. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks!
This is a native
meson format
command, similar tomuon fmt
.