google / google/go-jsonnet

formatter.Format is not applicable to ast.Node

Open
#670 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
1.8k
Forks
263
PR merge metrics
No merged PRs in 30d

Description

jsonnetfmt.Format makes a lot of good logic in the internal method without exposing as methods.

This results in disability to use custom-written formatters and get the best from jsonnetfmt, requiring to pipe results to jsonnetfmt after any changes, which is more frustrating when we already have ast.Node and do not need to unparse it again.

Let's expose everything Format does as a new method `FormatNode(root ast.Node, finalFodder ast.Fodder, options formatter.Options)` and keep initial Format() as a wrapper that does AST and applies FormatNode to it?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.