Commit Graph

13 Commits

Author SHA1 Message Date
Tim Vergenz
e6f64e89f1
feat: add |||- chomped text block syntax (#773)
Resolves google/jsonnet#289

Companion PR to google/jsonnet#1175
2025-01-20 21:45:15 +00: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
Jesse
2655afd2bd
memory align structs (#635)
feat: align most structs and add lint rule to enforce struct alignment
2022-10-19 06:19:15 +01:00
Angus Lees
856bd58872 Add 'importbin' statement
Add `importbin` statement.  Similar to `importstr` but the result is
an array of numbers (all integers 0-255).
2022-03-03 22:49:02 +00:00
Dave Cunningham
6fdbe3d728 Rest of corresponding change to formatter, see https://github.com/google/jsonnet/pull/937 2021-12-21 12:22:28 +00:00
Dave Cunningham
f60b015405 Corresponding change to formatter, see https://github.com/google/jsonnet/pull/937 2021-12-21 12:17:41 +00:00
Dave Cunningham
c187d5b373
fix bazel rules for formatter (#563) 2021-09-08 11:18:01 +01:00
Stanisław Barzowski
5899996502 Make go linter happy again. 2021-05-19 15:10:49 +02:00
Simon Let
415d036e5e Put AddPlusObject behind an option, rename FixPlusObject 2021-04-29 22:55:07 +02:00
Simon Let
be7a92aa5c jsonnetfmt: Add plus objects instead of removing them 2021-04-29 22:55:07 +02:00
Stanisław Barzowski
b70cbd441a Anonymous Import Locations
We used to treat dummy paths like <stdin>, <std>, <extvar> as
real import locations, which causes obvious problem for importers.

After this change we consistently pass "" (an empty string) as location
for non-imported paths.

We exposed new functions to properly handle all paths.

The first function family, EvaluateFile* which allow evaluating
a Jsonnet program at a specified importable path. It should
be used in most cases.

The second function family, EvaluateAnonymousSnippet* allows evaluating
a snippet without an importable path. It should be used for situations
like the code passed as a commandline argument, stdin, etc.

The old function family, EvaluateSnippet* is now deprecated, but
works the same as before, i.e. the passed filenames are treated
as imported paths.

Changes are required to custom importers to make sure they satisfy
the refined contract.

Fixes #329.
2020-09-08 17:27:47 +02: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
Dave Cunningham
724650d358
Add native golang formatter (#388)
Add native golang formatter
2020-03-10 22:19:49 +00:00