Skip to content
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

Formatter #3034

Merged
merged 39 commits into from Mar 9, 2023
Merged

Formatter #3034

merged 39 commits into from Mar 9, 2023

Conversation

jwiesler
Copy link
Contributor

@jwiesler jwiesler commented Feb 10, 2023

The current Java formatter used in the sequent view is a mess. This PR tries to improve on that.

Current changes:

  • Remove IOException out of the interface of all pretty printing functions since it is never thrown.
  • Rewrite PrettyPrinter on top of Layouter
  • Many changes to the interface of pretty printers
  • Bring internal taclet printer to same format as key file formatter
  • Warning when "decreases" clause is missing for loop spec (5b7829d and 5b7829d)
  • Fix double click on proof management tree (d7efb02)

@jwiesler jwiesler force-pushed the formatter branch 5 times, most recently from b91c974 to f6a843a Compare February 10, 2023 19:30
@wadoon
Copy link
Member

wadoon commented Feb 10, 2023

My question would be: "Why writing/polishing the old Java pretty printing if libraries (e.g., google-java-format) are available?"

@jwiesler
Copy link
Contributor Author

jwiesler commented Feb 10, 2023

It isn't just Java formatting it's Java formatting with jml asserts, method-frames, modalities and all the other stuff.

@wadoon
Copy link
Member

wadoon commented Feb 11, 2023

It isn't just Java formatting it's Java formatting with jml asserts, method-frames, modalities and all the other stuff.

Yes, and I would not built on top the Java parsing (which is realisied with Javac). I would go for the backend (the translation of Java AST into a document structure).

@jwiesler
Copy link
Contributor Author

I would go for the backend (the translation of Java AST into a document structure).

What does that even mean?

There exist classes to layout the remaining formulas for a given document width which are general enough to handle the Java part as well.
I don't see where using another library for the Java part would make this any easier.

@jwiesler jwiesler changed the title Draft: Formatter Formatter Feb 21, 2023
@jwiesler jwiesler force-pushed the formatter branch 3 times, most recently from c345c7e to 96f36e9 Compare February 21, 2023 17:39
@jwiesler
Copy link
Contributor Author

jwiesler commented Mar 6, 2023

This is done, the parsability problems are fixed.

Making single line pretty printed terms more readable in the GUI is postponed until a later changed.

auto-merge was automatically disabled March 9, 2023 13:13

Merge queue setting changed

@jwiesler jwiesler enabled auto-merge March 9, 2023 13:51
@jwiesler jwiesler added this pull request to the merge queue Mar 9, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Mar 9, 2023
@jwiesler jwiesler added this pull request to the merge queue Mar 9, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Mar 9, 2023
@jwiesler jwiesler added this pull request to the merge queue Mar 9, 2023
Merged via the queue into KeYProject:main with commit 9f69483 Mar 9, 2023
11 of 12 checks passed
@jwiesler jwiesler deleted the formatter branch March 9, 2023 22:39
jwiesler added a commit that referenced this pull request Mar 12, 2023
* Removes most manual passing of line, column and replaces it with
`Location`
* [Fix issue dialog pointing to the wrong line (at least on
Windows)](9894f7a)
* Fix many positioning issues coming from 0-based/1-based columns/lines
* Fix position information of block contracts and the like

Blocking on #3034. There are some usages in the `PrettyPrinter` I won't
fix since it's deleted there.

[Artiweb](https://keyproject.github.io/artiweb/3049/)
WolframPfeifer added a commit that referenced this pull request Mar 17, 2023
See #3071. This PR changes the saver to use a new printer method that
omits the final `;`. Probably the behaviour was inadvertantly modified
in #3034.
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.

None yet

3 participants