Skip to content

Add tlaplus-formatter support#327

Merged
FedericoPonzi merged 2 commits intotlaplus:masterfrom
FedericoPonzi:formatter
Feb 14, 2026
Merged

Add tlaplus-formatter support#327
FedericoPonzi merged 2 commits intotlaplus:masterfrom
FedericoPonzi:formatter

Conversation

@FedericoPonzi
Copy link
Copy Markdown
Collaborator

@FedericoPonzi FedericoPonzi commented Jul 21, 2024

Add support for the tlaplus-formatter to the vscode-extension. It is enabled by default. It reuses the module search paths that the user has configured. After each formatting, the formatter verifies the ast is valid and matches the one from before - if the check fails the old spec is produced in output, so it's safe to use. It can be disabled via settings, and it's enabled by default.

@lemmy lemmy added the enhancement New feature or request label Jul 21, 2024
@FedericoPonzi FedericoPonzi marked this pull request as ready for review July 21, 2024 22:55
@FedericoPonzi FedericoPonzi marked this pull request as draft July 21, 2024 22:55
@FedericoPonzi FedericoPonzi force-pushed the formatter branch 2 times, most recently from b2f1fed to a25fdf9 Compare July 21, 2024 23:22
@lemmy lemmy force-pushed the master branch 10 times, most recently from 2866e79 to 069d5c4 Compare August 16, 2024 07:37
@lemmy lemmy force-pushed the master branch 7 times, most recently from 606f3fc to 6213ee1 Compare March 5, 2025 02:13
@younes-io
Copy link
Copy Markdown
Collaborator

what is the status quo on this one?

@FedericoPonzi
Copy link
Copy Markdown
Collaborator Author

I don't think there is much to do here until the tlaplus formatter package (or other formatters) gets into a more mature state and becomes worth integrating into the plugin.

@lemmy
Copy link
Copy Markdown
Member

lemmy commented Nov 5, 2025

@FedericoPonzi A couple of months have passed, and it appears that you’re preparing a 0.1 release. Perhaps it’s time to revisit this PR?

@FedericoPonzi FedericoPonzi force-pushed the formatter branch 2 times, most recently from 65e7901 to a38d36d Compare February 11, 2026 23:17
@FedericoPonzi FedericoPonzi marked this pull request as ready for review February 11, 2026 23:21
@younes-io younes-io self-requested a review February 12, 2026 10:58
Comment thread src/formatters/tlaFormatter.ts
Comment thread src/formatters/tlaFormatter.ts Outdated
@lemmy
Copy link
Copy Markdown
Member

lemmy commented Feb 12, 2026

The formatter can’t come soon enough. Critics have argued that TLA+ hasn’t kept up with modern tooling standards, and the lack of a formatter is often mentioned as a concrete example.

Signed-off-by: Federico Ponzi <me@fponzi.me>
Copy link
Copy Markdown
Collaborator

@younes-io younes-io left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also was looking for a commit and couldn't find it; so not sure if history in this branch was re-written..

Comment thread src/formatters/tlaFormatter.ts Outdated
@FedericoPonzi
Copy link
Copy Markdown
Collaborator Author

I usually amend and work on the same commit. I've added a new commit to address your last comment now, thank you!

Signed-off-by: Federico Ponzi <me@fponzi.me>
Copy link
Copy Markdown
Collaborator

@younes-io younes-io left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thank you @FedericoPonzi

@FedericoPonzi FedericoPonzi merged commit 0c78f9f into tlaplus:master Feb 14, 2026
4 checks passed
@FedericoPonzi FedericoPonzi deleted the formatter branch February 14, 2026 15:24
@lemmy
Copy link
Copy Markdown
Member

lemmy commented Feb 14, 2026

Can't wait to give this a spin. :-) Should also be on the list at tlaplus/tlaplus#1311

@FedericoPonzi
Copy link
Copy Markdown
Collaborator Author

I'm happy to see the initial version merged finally :) I know it's not perfect yet, so please do share feedback and it can be improved over time

@lemmy
Copy link
Copy Markdown
Member

lemmy commented Feb 15, 2026

  • For a spec that extends some CommunityModule that are packaged as part of the extension:
Formatter error: Exception in thread "main" me.fponzi.tlaplusformatter.exceptions.SanySyntaxException: 
*** Errors: 1 Unknown location Cannot find source file for module Functions imported in module DieHardest. at
me.fponzi.tlaplusformatter.SANYWrapper.ThrowOnError(SANYWrapper.java:98) at
me.fponzi.tlaplusformatter.SANYWrapper.loadSpecObject(SANYWrapper.java:85) at
me.fponzi.tlaplusformatter.SANYWrapper.load(SANYWrapper.java:42) at
me.fponzi.tlaplusformatter.TLAPlusFormatter.<init>(TLAPlusFormatter.java:41) at
me.fponzi.tlaplusformatter.Main.mainWrapper(Main.java:99) at me.fponzi.tlaplusformatter.Main.main(Main.java:134)
  • The formatter appears to inserts a whitespace after the box operator, causing [][Next] to be reformatted to [] [Next]. This is rather unusual formatting.

@FedericoPonzi
Copy link
Copy Markdown
Collaborator Author

FedericoPonzi commented Feb 15, 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

3 participants