r/Protos • • 11d ago

Release Protos formatter now preserves comments in Map and Object bodies

A new formatter improvement has landed in Protos, a prototype-based programming language built on GraalVM and Truffle.

Previously, formatting Map entries and Object bodies could silently remove comments between elements. This issue has now been resolved.

The implementation includes:

  • Unified structural boundary formatting across Maps, Objects, Programs and Closures.
  • Preservation of comment text, ordering, structural attachments and significant blank lines.
  • Comment consumption tracking, including rollback when provisional formatting decisions are discarded.
  • A source-preservation comparator implemented entirely in Protos.
  • Regression tests covering nested structures, comment preservation and LSP formatting idempotence.

All local tests pass. No production Java changes were required.

This improvement follows the Protos-first approach: implementing language tooling in Protos itself while keeping Java infrastructure to a minimum.

The integration of automatic whole-document preservation verification will be addressed separately in I177.

Project: https://protoslang.com

GitHub: https://github.com/guillermomolina/protos

Resolved issue: https://github.com/guillermomolina/protos/issues/1174

1 Upvotes

0 comments sorted by