palantir / palantir/palantir-java-format
IntelliJ palantir-java-format plugin doesn't organize imports
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 907
- Forks
- 101
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 19
Description
My team is attempting to utilize the palantir java formatter in conjunction with Gradle and Spotless. Executing ./gradlew spotlessApply works great, and formats our files as expected.
Additionally, we've installed the palantir-java-format IntelliJ plugin which auto-formats my Java files on save so that we don't need to manually execute spotlessApply prior to every commit. The plugin executes the palantir formatter on save, however we've found that it doesn't organize imports or remove unused imports.
Checking the File | Settings | Tools | Actions on Save | Optimize imports checkbox does appear to organize our imports, but it doesn't respect the palantir import structure, and seems to instead utilize IntelliJ's code style import config. This appears to be the opposite behavior from the Reformat code checkbox which ignores the IntelliJ code style config, and forces the palantir formatter.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by examining the IntelliJ plugin's Actions on Save integration and how it handles Optimize imports versus Reformat code. Reproduce the behavior with IntelliJ and the Gradle/Spotless setup described in the issue. Done means save-time formatting also organizes imports and removes unused imports while respecting the Palantir import structure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- developer-experience, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100