Skip to content

Formatter should handle [{...}] better #230

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

Open
huggsboson opened this issue Aug 19, 2016 · 1 comment
Open

Formatter should handle [{...}] better #230

huggsboson opened this issue Aug 19, 2016 · 1 comment

Comments

@huggsboson
Copy link
Contributor

jsonnet fmt changed the following code from:

                        volumeMounts: [
                            {
                                name: "deployment-config",
                                mountPath:
                                    if cluster.isLocal then
                                        "/box/deployment-config"
                                    else
                                        "/box"
                                ,
                            },
                        ],

to:

                        volumeMounts: [
                            {
                                name: "deployment-config",
                                mountPath:
                                    if cluster.isLocal then
                                        "/box/deployment-config"
                                    else
                                        "/box",
                                },
                        ],

which is mis-indented. My personal taste would have had the whole thing turned to:

                        volumeMounts: [{
                            name: "deployment-config",
                            mountPath:
                                if cluster.isLocal then
                                    "/box/deployment-config"
                                else
                                    "/box",
                        }],
@sparkprime
Copy link
Collaborator

sparkprime commented Aug 19, 2016

#231 should fix the first issue

As for [{...}] it will already preserve that style, but actually enforcing the style is a feature request. As for the actual logic, I suppose you're asking for the newlines to be removed for single element arrays of the form [ expr (optional comma) ]
It's quite easy to write a pass in formatter.cpp to implement that.

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

No branches or pull requests

2 participants