604 Commits

Author SHA1 Message Date
Daniel Chao
9e1303ed57 Disable spotless ratcheting of Pkl sources (#1295)
This causes spotless to _always_ format Pkl files, instead of only
formatting them if there's a diff between the file and what's in main.

This means that formatting changes in pkl-formatter will be propagated
to the standard library.
2025-11-04 05:31:49 -08:00
Dan Chao
4c13952b64 Apply spotless formatting 2025-11-03 12:26:58 -08:00
Dan Chao
4d70baba86 Start next dev iteration 2025-11-03 12:26:58 -08:00
Dan Chao
7f231cd916 Prepare 0.30.0 release 2025-11-03 12:26:58 -08:00
Jen Basch
5c944600fa Use 2xlarge resource class for gradle check in CI (#1291) 2025-11-03 10:31:16 -08:00
Islon Scherer
5030061412 Fix ordering issue in formatter (#1289) 2025-11-03 18:52:38 +01:00
Daniel Chao
219e766003 Make format command write relative paths (#1290) 2025-11-03 09:52:29 -08:00
Daniel Chao
d29ae07e14 Fix formatting of argument lists (#1283)
This fixes several issues:

1. Leading/trailing line comments surrounding a lambda should make that
   lambda not "trailing", because the formatting otherwise looks bad and
   also isn't stable
2. Fix incorrect algorithm for detecting trailing lambda (currently,
   any number of lambdas makes the alg return `true`)
2025-11-03 09:15:58 -08:00
Islon Scherer
4226c21a42 Fix multiline string stability (#1287) 2025-11-03 17:41:43 +01:00
Daniel Chao
40c88930c5 Normalize paths in pkl format (#1286) 2025-11-03 08:24:04 -08:00
Daniel Chao
d5beb3f331 Fix flag name (#1285) 2025-11-03 08:23:35 -08:00
Daniel Chao
d8adb28dd1 Respect line breaks in operator chains and argument lists (#1268)
If an operator chain or method call is multiline, keep those newlines
in the formatted output.

Help preserve code like:

```
foo
  |> (it) -> it + 2
  |> (it) -> it / 2
```
2025-11-02 21:51:37 -08:00
Daniel Chao
85529c9b7e Add debug and run button for snippet tests (#1281) 2025-10-31 12:28:03 -07:00
Islon Scherer
50541d9cda Make formatter stable (#1273) 2025-10-31 18:58:22 +01:00
Daniel Chao
ea778a7e7a Don't force multiline interpolation into a single line (#1280)
Also, fixes an issue where forced single-line formatting would break for if/else
and let expressions

---------

Co-authored-by: Islon Scherer <islonscherer@gmail.com>
2025-10-31 10:47:53 -07:00
Jen Basch
ffc9167bf5 Switch yaml.Parser to parse binary scalars as Bytes (#1277) 2025-10-30 16:45:59 -07:00
Daniel Chao
ede48d0fff Fix pkl spotless (#1279) 2025-10-30 16:17:08 -07:00
Jen Basch
eab71229e7 Add support for rendering Bytes values with YamlRenderer (#1276) 2025-10-30 15:53:43 -07:00
Daniel Chao
10eccb100c Fix Pkl spotless formatting (#1278) 2025-10-30 15:36:30 -07:00
Jen Basch
2c18f13d08 Rename Config.from to Config.fromPklBinary (#1275) 2025-10-30 11:04:03 -07:00
Jen Basch
9427387019 Add release notes for 0.30 (#1261)
Co-authored-by: Dan Chao <dan.chao@apple.com>
2025-10-30 10:09:35 -07:00
Islon Scherer
db800d4521 Fix trailing lambda ending wrap (#1274) 2025-10-30 17:06:09 +01:00
Jen Basch
08c414f3ac Normalize mutli-line string indentation (#1271) 2025-10-30 08:30:30 -07:00
Islon Scherer
9469dd885d Handle trailing commas in types (#1272) 2025-10-30 13:36:56 +01:00
Islon Scherer
7df447924e Coalesce pkl format subcommands into the parent command. (#1263) 2025-10-30 10:08:25 +01:00
Jen Basch
7bf150055c Assert that formatter snippet test output is stable (#1270) 2025-10-29 17:08:43 -07:00
Jen Basch
1d6261b263 Correctly handle trailing commas in function type literals in the generic parser (#1267) 2025-10-29 15:08:26 -07:00
Islon Scherer
72874ec34a Get style guide in line with formatter (#1265) 2025-10-29 16:00:05 +01:00
Islon Scherer
28c20a8652 Don't break lines in module name (#1266) 2025-10-29 15:24:08 +01:00
Daniel Chao
bbeeffdd32 Adjust formatting of line comments in lets (#1256) 2025-10-28 17:53:06 -07:00
Daniel Chao
825fcf5d1d Respect newlines in if/else and let expressions (#1259)
Change the formatter to prevent multiline if/else and let expressions
from collapsing into a single line.
2025-10-28 11:26:31 -07:00
Daniel Chao
fbcf83aa76 Adjust formatting of argument lists (#1260)
This changes code so that multiple lambda arguments makes the whole
argument list wrap.

Improves the readability of code like:

```
foo
  .toMap(
    (it) -> makeSomeKey(it),
    (it) -> makeSomeValue(it)
  )
```
2025-10-28 10:46:19 -07:00
Islon Scherer
be0142d46b Add grammar compatibility option to the formatter (#1249) 2025-10-28 13:29:08 +01:00
Daniel Chao
ef4989aa35 Wrap comments in base.pkl to 100 chars (#1258)
Also, strip line numbers from reflectedDeclaration.pcf
2025-10-27 16:00:48 -07:00
Daniel Chao
1a25e044ac Polish documentation for pkl-binary (#1250) 2025-10-26 21:23:57 -07:00
Spencer Phillip Young
fdb2bd8c75 Fix Lexer EOF sentinel collision with valid Unicode code points (#1251)
Fixes an issue where sentinel value (U+7FFF) occurring literally in the source could cause a premature termination of parsing, leading to potential EOF injection attacks.

---------

Co-authored-by: Dan Chao <dan.chao@apple.com>
2025-10-26 15:53:48 -07:00
Daniel Chao
a8f76d6209 Adjust formatting of qualified access chains (#1252)
This adjusts formatting of qualified access chains so that leading
dot calls are kept in the same line if possible.
2025-10-24 16:48:21 -07:00
Daniel Chao
c7680aea1f Enforce Pkl formatting of stdlib with spotless (#1253)
This adds a spotless formatting step using the new pkl formatter.

This only formats Pkl sources in the stdlib, because other sources
are possibly test input and not meant to be formatted.
2025-10-24 10:15:14 -07:00
Daniel Chao
3223083324 Format interpolated expressions as single line (#1247)
This forces iterpolated expressions to be single-line, so that newline
literals within the bounds of two string delimiters can be seen as
verbatime newlines in the resulting string.

Edge case: in the case of a line comment, it's not possible to keep
this as a single line expression.
These are kept as multi-line expressions.

Also:

* Remove `ForceWrap`, this node is not used.
* Rename `StringConstant` -> `StringChars`
2025-10-24 03:23:41 -07:00
Daniel Chao
cce49a40fa Add internal intellij plugin (#1248)
This introduces an IntelliJ plugin that's meant to assist with development of the Pkl codebase itself.

The plugin adds a file editor that opens snippet tests in a split editor pane, showing the input on the left side and output on the right side.
2025-10-21 03:42:21 -07:00
Islon Scherer
f6d3fb1228 Fix let formatting (#1246) 2025-10-21 09:45:27 +02:00
Jen Basch
6c036bf82a Implement Pkl binary renderer and parser (#1203)
Implements a binary renderer for Pkl values, which is a lossless capturing of Pkl data.

This follows the pkl binary format that is already used with `pkl server` calls, and is
made available as a Java API and also an in-language API.

Also, introduces a binary parser into the corresponding `PObject` types in Java.
2025-10-20 09:10:22 -07:00
Jen Basch
c602dbb84c Fix macOS Intel native builds (#1244) 2025-10-16 19:20:14 -07:00
Jen Basch
bed008b3da Update macOS release in CI (#1243) 2025-10-16 15:48:23 -07:00
Daniel Chao
80a4dc9617 Fix typos (#1242) 2025-10-16 14:18:49 -07:00
Daniel Chao
b8aad85943 Fix tracking of known usages/subtypes (#1241)
Fixes an issue where known subtype/usage information is not gathered.

Also: change class RuntimeData to not return pairs for better composability.
2025-10-16 12:48:35 -07:00
Daniel Chao
91fec70668 Fix publication of pkl-config-kotlin (#1240)
This fixes a regression where the pkl-config-kotlin library would not
publish after upgrading to Gradle 9.1
2025-10-16 00:44:08 -07:00
Daniel Chao
8c5bd3b7dd Apply pkl formatter to codebase (#1236)
This applies the Pkl formatter to `stdlib/` and `.circleci/`
2025-10-09 15:16:38 -07:00
Daniel Chao
42dcad25c6 Fix error message when reading a resource/module past root dir (#1234) 2025-10-09 10:16:33 -07:00
Daniel Chao
3a29ea8998 Format lambda chains (#1235)
This changes the formatter to only force line on call chains
with multiple lambdas

With this change, this is kept as a single line:

```
foo.bar.map((it) -> it + 1)
```
2025-10-09 10:16:13 -07:00