dprint / dprint-intellij

A dprint plugin for Intellij.
https://plugins.jetbrains.com/plugin/18192-dprint
MIT License
12 stars 2 forks source link

Java Imports Optimizer #38

Closed azherebtsov closed 1 year ago

azherebtsov commented 2 years ago

IntelliJ has a custom process for running optimize imports action. This process can be triggerred as a pre-commit action. The problem arises when IntelliJ imports optimizer behaves differently comparing to what Java formatting plugin can do.

As a solution I'm adding a hook for optimize imports action. Dprint core is language agnostic and does not support a special message like "optimize imports". Therefore, I'm invoking plain format action assuming that underlying formatter will do imports optimization on it's own.

Open question: should I add a checkbox to the IJ plugin settings which will enable/disable Imports optimizer?

azherebtsov commented 2 years ago

Hey @ryan-rushton ! Would you mind to take a look at this proposal?

azherebtsov commented 1 year ago

CC @FireFry

ryan-rushton commented 1 year ago

Can do! Will check it out today.