This adds IntelliJ formatter integration through the async formatter service. This only became available in the latest version of IntelliJ.
Some of our backend folk have requested tighter integration with the IntelliJ formatter. By doing this they can run import optimisations at the same time as formatting (Java using the new exec plugin).
Restrict IntelliJ version to a minimum of 2021.3.1 (this is where the async formatter interface became available)
Add a DprintExternalFormatter class the hooks into the AsyncDocumentFormattingService. This will replace the default IntelliJ formatter when its canFormat method returns true
Add a DprintDocumentMerger class so an unsaved formatting will be saved into the relevant file.
This adds IntelliJ formatter integration through the async formatter service. This only became available in the latest version of IntelliJ.
Some of our backend folk have requested tighter integration with the IntelliJ formatter. By doing this they can run import optimisations at the same time as formatting (Java using the new exec plugin).
For this I took inspiration from both
Some of the things done in this PR
DprintExternalFormatter
class the hooks into theAsyncDocumentFormattingService
. This will replace the default IntelliJ formatter when itscanFormat
method returns trueDprintDocumentMerger
class so an unsaved formatting will be saved into the relevant file.