palantir / palantir/palantir-java-format

Excessive import optimization in intellij

Open
#1,088 4 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
907
Forks
101
Avg merge
1d 3h
Merged PRs (30d)
19

Description

What happened?

I'm running version 2.46.0 of the plugin with intellij 2024.1.1

With the latest version of the plugin intellij sometimes gets in a state where every key press triggers an optimize imports/reformat. For example, when writing a javadoc every keypress causes intellij to optimize imports. The other scenario I've noticed is hitting enter in outside a method in a java source file triggers a reformat/optimize imports - immediately removing the new line I just added. For both of these scenarios I've been temporarily disabling the plugin until I'm done doing work, and then re-enabling to format.

I'll add an update if I'm able to figure out what triggers the excessive optimization behavior to start, as it doesn't always occur.

What did you want to happen?

Less frequent reformats and optimizations. Ideally the reformats could occur on save

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the behavior with palantir-java-format plugin 2.46.0 in IntelliJ 2024.1.1, testing both Javadoc edits and pressing Enter outside a Java method. Record what triggers the repeated optimize-imports and reformat actions. Done means normal typing no longer reformats continuously, with formatting and import optimization occurring at the intended time.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.