-
Notifications
You must be signed in to change notification settings - Fork 266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Format lemma
in the IDE
#4269
Labels
part: formatter
Code formatter for Dafny source code
Comments
Likely related to #4270 |
MikaelMayer
added a commit
that referenced
this issue
Jul 14, 2023
This PR fixes #4269 and fixes #4270 I first added unit tests for the cases that were failing. What really solved the issue was that I had to implement proper cloning for - methods, that were not keeping BodyStartTok - formals, that were not keeping RangeToken Then I also added for all formatting test a case when it tries to clone all members before formatting, like VSCode does, which unveiled 3 more formatting issues: ``` method Test() { g := new ClassName.ConstructorName( argument1b, // Two extra spaces argument2b, argument3b ); var g := new ClassName.ConstructorName( argument1, // Missing two extra spaces (when block mode activated) argument2, argument3 ); ... && unchanged( this, c ) && old( // Extra undesired space here c.c ) == c.c && fresh( c.c ) ``` I also solved the above issues by: * Ensuring the `RangeToken` of `TypeRHS` is preserved after cloning by modifying its topmost cloning parent `AssignmentRHS` * Ensure we iterate on pre resolved children to get `OwnedToken` (otherwise some cloned expressions were crashing) * Ensure `UnchangedExpr` is cloned with the same pattern as everyone else (otherwise the `RangeToken` wasn't kept) <small>By submitting this pull request, I confirm that my contribution is made under the terms of the [MIT license](https://github.com/dafny-lang/dafny/blob/master/LICENSE.txt).</small>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The following is what the IDE Format Document does.
The CLI does what you would expect.
(tested on both latest and nightly)
Note the indentation of
{
onlemma
The text was updated successfully, but these errors were encountered: