10 Commits

Author SHA1 Message Date
John Bartholomew
5400c708a2 add test cases for add_plus_object formatter pass 2026-02-24 18:28:34 +00:00
John Bartholomew
1ef3750d6c simplify and clean up formatter_test
There were various bits of dead code and easily simplified things.
2026-02-24 18:28:21 +00:00
John Bartholomew
71c8de23c2 chore: regenerate Bazel files, use go.mod to specify Go SDK version
This brings things more into line with modern conventions for
build target names, and means we have fewer sources of truth for
the minimum Go version that's needed.
2026-02-18 23:06:15 +00:00
Mickael Carl
106c8f0c6c Use default options for formatter tests 2025-03-06 23:48:39 +00:00
Mickael Carl
6d83c91d49 Fix an out-of-bounds array access when formatting some empty comment 2025-03-06 23:48:39 +00:00
John Bartholomew
64c3804248 update Bazel rules with gazelle and manually 2025-01-20 21:45:24 +00:00
itchyny
463509825c
chore: update rules_go and gazelle version to fix bazel build (#756)
* chore: update rules_go and gazelle version to fix bazel build

* chore: fix source file list in ast directory (ref: #746)

* chore: fix dependency list in formatter directory
2024-06-10 21:24:27 +01:00
Thomas Neidhart
c8d95b9a6f
Gracefully handle encountered regular expression when running jsonnetfmt (#724)
* Gracefully handle encountered regular expression when running jsonnetfmt, adding tests.

* Do not validate verbatim strings.

* Also do not validate string blocks.

* Change golden prefix for formatter tests to fmt.golden to be consistant with cpp version.
2024-06-09 15:32:29 +01:00
Charles Korn
7b9f5fd4b4
Expose "unparse", FormatNode and RawAST (#710)
* Export FormatNode so external users can pretty print an AST

Signed-off-by: Tom Wilkie <tom@grafana.com>

* Expose RawAST function.

Signed-off-by: Tom Wilkie <tom@grafana.com>

* Add comment

Signed-off-by: Tom Wilkie <tom@grafana.com>

---------

Signed-off-by: Tom Wilkie <tom@grafana.com>
Co-authored-by: Tom Wilkie <tom@grafana.com>
2023-06-14 19:56:49 +01:00
sh0rez
4f4aa80dd7 feat(api): expose formatter
Exposes what I consider a good public API from the `internal/formatter`
package.

Having a go-native formatter is an awesome thing, especially because it
allows shipping the formatter as part of other projects. It's also fair
to keep the formatter's code in `internal`, yet third party projects
should have a way to use relevant parts of it.
2020-03-31 20:43:25 +02:00