-
Notifications
You must be signed in to change notification settings - Fork 1
Description
I think/hope this is the last big issue I should be facing :) I'd like to know if there is a recommended strategy for handling comments.
In the TLA's AST, the comments are attached to the first node right after the comment. When building the Doc of that node, I'll first prefix the comment to it. In TLA+ specs people like to make comment blocks like this: (from file: TowerOfHanoi.tla)
(***************************************************************************)
(* TRUE iff i is a power of two *)
(***************************************************************************)
PowerOfTwo(i) == i & (i-1) = 0
This is problematic because the comment block gets included as a text in the same group that contains PowerOfTwo. This causes the formatter to produce:
(***************************************************************************)
(* TRUE iff i is a power of two *)
(***************************************************************************)
PowerOfTwo(i) == i & ( i - 1 ) = 0
Do you have any recommendation on how to best handle this? According to https://prettier.io/docs/rationale.html it's also a challenge for prettier.
Update: this commit seems to be working for tlaplus-formatter though I haven't tested it a lot: main...FedericoPonzi:prettier4j:issue-156