-
Notifications
You must be signed in to change notification settings - Fork 62
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
Weird GDFormat style guidelines #295
Comments
I should note the example formatted differently I guess: Pythonmy_array.append(
{
# no-wrap
"some": "a",
"thing": "b",
"is_weird": "something very long",
}
) Javamy_array.append({
"some": "a",
"thing": "b",
"is_weird": "something very long",
}) C++my_array.append({
"some": "a",
"thing": "b",
"is_weird": "something very long",
}) Javascriptmy_array.append({
"some": "a",
"thing": "b",
"is_weird": "something very long",
}) |
I think it was discussed already in some issue but I couldn't find it. Anyway - I'd love to add support for such compact conventions but the thing is that it would take a lot of time to implement. Currently, the formatter operates in 2 modes (or strategies if you will) and chooses the one that fits better at a given point:
The correct approach to implement compact multiline formatting would be to add a new, 3rd strategy and use it in cases where it fits better. Such a strategy would require implementing custom formatting rules for all parse tree nodes which (assuming full test coverage) would require tons of man-hours to implement. Therefore- realistically speaking - this feature probably won't ever be implemented although it would be a cool thing to have I agree. |
Regarding the provided code examples, I share the opinion that the current
GDFormat
output could be improved to align better with popular formatting conventions:The
GDFormat
currently formats it as:The extra newline between
append(
and{
, as well as the space between the dot and the method name, make the code a bit harder to read and deviate from common conventions.append(
and{
:And finally the Godot source code itself.
The text was updated successfully, but these errors were encountered: