Skip to content

Add optimize_imports tool#51

Open
Nostereal wants to merge 1 commit intoJetBrains:masterfrom
Nostereal:add-optimize-imports-tool
Open

Add optimize_imports tool#51
Nostereal wants to merge 1 commit intoJetBrains:masterfrom
Nostereal:add-optimize-imports-tool

Conversation

@Nostereal
Copy link
Copy Markdown

Summary

  • Adds a new MCP tool optimize_imports that removes unused imports and reorders remaining imports according to project code style settings
  • Implementation follows the same pattern as reformat_file — resolves the file via PSI, runs OptimizeImportsProcessor on EDT, and waits for completion via CountDownLatch

Closes #50

Test plan

  • Install the plugin in a JetBrains IDE
  • Call optimize_imports with a file containing unused imports
  • Verify unused imports are removed and remaining imports are reordered per project code style
  • Verify error responses for non-existent files and missing project directory

🤖 Generated with Claude Code

Adds a new MCP tool that removes unused imports and reorders remaining
imports according to project code style settings.

Implementation follows the same pattern as reformat_file — resolves the
file via PSI, runs OptimizeImportsProcessor on EDT, and waits for
completion via CountDownLatch.

Closes JetBrains#50

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Add optimize_imports and run_code_cleanup tools

2 participants