An IntelliJ Platform plugin that adds bulk Optimize Imports actions, running the built-in per-language optimizer on many files at once instead of one file at a time.
Both actions collect the target files' PSI, feed them to the platform's
OptimizeImportsProcessor (a single undoable command), and live in the
Code menu right after the standard Optimize Imports item.
- Optimize Imports All Tabs — every file currently open in an editor tab. Enabled when at least one tab is open.
- Optimize Imports Changed Files — every file with uncommitted VCS changes
(modified/added files in an active change list, via
ChangeListManager). Enabled when there are uncommitted changes.
build.gradle.kts Gradle build (IntelliJ Platform Gradle Plugin 2.x)
settings.gradle.kts
gradle.properties
src/main/kotlin/.../OptimizeImportsAllTabsAction.kt all open tabs
src/main/kotlin/.../OptimizeImportsChangedFilesAction.kt uncommitted changes
src/main/resources/META-INF/plugin.xml plugin descriptor
This project uses the Gradle wrapper. The wrapper JAR
(gradle/wrapper/gradle-wrapper.jar) is a binary and is not included here
(it could not be downloaded in this environment). Generate it once with a local
Gradle installation:
gradle wrapper --gradle-version 8.10.2After that, the usual tasks work:
./gradlew buildPlugin # produces build/distributions/*.zip
./gradlew runIde # launches a sandbox IDE with the plugin installedAlternatively, open the project in IntelliJ IDEA (with the Plugin DevKit and
Gradle support) and use the generated runIde run configuration.
Settings ▸ Plugins ▸ ⚙ ▸ Install Plugin from Disk… and pick the ZIP from
build/distributions/.
- Targets IntelliJ Platform build
242+(2024.2). AdjustsinceBuildinbuild.gradle.ktsif you need an older baseline. - Depends on
com.intellij.modules.platformandcom.intellij.modules.vcs(the latter for the changed-files action'sChangeListManager), so it loads in any JetBrains IDE with VCS support; import optimization itself is provided per-language by the IDE.