Skip to content

Feature Request: Add optimize_imports and run_code_cleanup tools #50

Description

Problem

When using replace_text_in_file, the plugin auto-saves the file immediately after modification. This means IntelliJ's Actions on Save (optimize imports, reformat, code cleanup) never triggers — the file is never "dirty" from the IDE's perspective when the save occurs.

This leaves unused imports, unoptimized code, and other cleanup issues in place after MCP-driven edits, which is the opposite of what happens when editing manually in the IDE.

Requested Tools

  • optimize_imports — run import optimization on a specified file (equivalent to Code → Optimize Imports)
  • run_code_cleanup — run the configured code cleanup inspection profile on a specified file (equivalent to Code → Code Cleanup)

Alternative

An option on replace_text_in_file (e.g. triggerActionsOnSave: true) to trigger the configured Actions on Save after the edit, rather than a plain save.

Context

This is especially relevant for Java projects where IDE-managed imports and code cleanup are a standard part of the workflow. When AI assistants edit files via MCP, the resulting code should match what the developer would see if they made the same edit manually in the IDE.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions