Skip to content

Update formatting branch from #67#82

Merged
schveiguy merged 15 commits into
masterfrom
formattingupdate
May 3, 2026
Merged

Update formatting branch from #67#82
schveiguy merged 15 commits into
masterfrom
formattingupdate

Conversation

@schveiguy

Copy link
Copy Markdown
Owner

@gulugulubing I reworked how the formatter works.

This is essentially your branch, but I divided the abstraction into two types.

  • JSONOutputter which only is concerned with outputting valid JSON/JSON5, not caring about spacing.
  • JSONStandardFormatter which implements formatting options as we discussed.

The idea is to make the formatter code simple, while relying on the state machine in JSONOutputter to do all the heavy lifting.

Note that I implemented the entire state machine for JSON (including colons and commas) this is necessary so the spacing can properly be implemented from a higher-level type. It made the logic a bit easier to write as well.

This still isn't finished, I think there are some API pieces to write. And of course, the serialize function family should use the formatter.

I'm thinking we can close #67 if you are ok with it? Let me know.

@schveiguy

Copy link
Copy Markdown
Owner Author

Note, formatjson is no longer valid, I have to rework that with the new API.

@gulugulubing

Copy link
Copy Markdown
Contributor

I'm thinking we can close #67 if you are ok with it? Let me know.

Sounds good. I'll follow along the new design. Feel free to close #67 — I'm fine with it.

@schveiguy schveiguy mentioned this pull request Apr 26, 2026
@schveiguy

Copy link
Copy Markdown
Owner Author

Ready to merge this, then work on updating the serializer to use this.

@schveiguy
schveiguy merged commit 34a519b into master May 3, 2026
6 checks passed
@schveiguy
schveiguy deleted the formattingupdate branch May 3, 2026 03:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants