An IntelliJ IDEA plugin that leverages AI to improve your code. Select code, provide instructions, and let AI enhance it with useful comments, optimizations, and more. https://plugins.jetbrains.com/plugin/29204-aicodeimprover
Find a file
2025-12-01 18:31:07 +03:00
.github/workflows Add CI workflow 2025-11-30 14:59:19 +03:00
.idea Add ansync code update 2025-11-30 13:18:04 +03:00
.intellijPlatform Add ansync code update 2025-11-30 13:18:04 +03:00
.run Initial commit 2025-09-09 20:42:02 +03:00
gradle/wrapper Initial commit 2025-09-09 20:42:02 +03:00
img Add readme 2025-11-30 14:35:23 +03:00
src/main Update plugin icon 2025-12-01 18:22:12 +03:00
.gitignore Add ansync code update 2025-11-30 13:18:04 +03:00
build.gradle.kts Update plugin version 2025-12-01 18:31:07 +03:00
build.sh Add build script 2025-11-30 14:54:11 +03:00
gradle.properties Initial commit 2025-09-09 20:42:02 +03:00
gradlew Initial commit 2025-09-09 20:42:02 +03:00
gradlew.bat Initial commit 2025-09-09 20:42:02 +03:00
README.md Add CI workflow 2025-11-30 14:59:19 +03:00
settings.gradle.kts Initial commit 2025-09-09 20:42:02 +03:00

AI Code Improver

An IntelliJ IDEA plugin that leverages AI to improve your code. Select code, provide instructions, and let AI enhance it with useful comments, optimizations, and more.

Features

  • AI-Powered Code Improvement: Use local AI models via LMStudio to enhance selected code
  • Customizable Prompts: Configure system prompts and temperature settings
  • Interactive Diff View: Review changes before applying them
  • Regeneration Support: Reject and regenerate improvements with feedback
  • Easy Integration: Right-click context menu and keyboard shortcut

Prerequisites

  • JetBrains IDE (IntelliJ IDEA, PhpStorm, PyCharm, WebStorm, etc.) version 2025.1 or later
  • LMStudio running locally with a compatible model loaded
  • Java 21+

Compatibility

This plugin works with all JetBrains IDEs based on the IntelliJ Platform 2025.1 or later, including:

  • IntelliJ IDEA
  • PhpStorm
  • PyCharm
  • WebStorm
  • CLion
  • GoLand
  • And other JetBrains IDEs

Building from Source

If you want to build the plugin yourself:

Prerequisites

  • Java 21 or later - Required for compilation
  • Git - For cloning the repository

Installing Java

Ubuntu/Debian:

sudo apt update
sudo apt install openjdk-21-jdk

Arch Linux:

sudo pacman -S jdk-openjdk

macOS:

brew install openjdk@21

Windows: Download and install from Adoptium or Oracle

Build Steps

  1. Clone this repository:

    git clone https://github.com/CatInBeard/IntelijAiCodeImproverPlugin.git
    cd intelij-ai-code-imporver-template
    
  2. Run the build script:

    ./build.sh
    

    Or manually:

    ./gradlew build
    
  3. The plugin JAR will be created in build/libs/

The build script will check for prerequisites and provide helpful error messages if Java is not installed.

Continuous Integration

The project includes GitHub Actions CI/CD that automatically builds the plugin on every push to the master branch. You can download the latest build artifacts from the Actions tab in the repository.

Installation

  1. Download the plugin JAR from the releases page or build it from source
  2. In your JetBrains IDE, go to File > Settings > Plugins
  3. Click the gear icon and select Install Plugin from Disk...
  4. Select the downloaded or built JAR file
  5. Restart your IDE

Configuration

After installation, configure the plugin settings:

  1. Go to File > Settings > Tools > AI Code Improver

Plugin Settings

Configure the following:

  • LMStudio URL: Default is http://localhost:1234/api/v0
  • System Prompt: Instructions for how the AI should behave
  • Model: Select from available models in LMStudio
  • Temperature: Controls randomness (0.0 = deterministic, 1.0+ = creative)

Usage

Basic Usage

  1. Select code in the editor
  2. Right-click and choose AI Improve from the context menu

Context Menu

  1. Enter your improvement instructions

Prompt Dialog

  1. Review the AI-generated improvements in the diff view

Diff View

  1. Choose to apply, reject, or regenerate with feedback

Keyboard Shortcut

Use Ctrl+Alt+I to quickly access the AI improvement feature on selected code.

Regeneration

If you're not satisfied with the result, you can reject and provide feedback for regeneration:

Regenerate Prompt

How It Works

The plugin communicates with your local LMStudio instance to:

  1. Send the selected code and your instructions
  2. Receive AI-generated improvements
  3. Display changes in IntelliJ's built-in diff viewer
  4. Allow you to apply changes directly to your code

Troubleshooting

  • Connection Issues: Ensure LMStudio is running and accessible at the configured URL
  • No Models Available: Make sure you have downloaded and loaded models in LMStudio
  • Plugin Not Loading: Check that you're using a compatible IntelliJ IDEA version

Contributing

Contributions are welcome! Please feel free to submit issues and pull requests.

License

This project is licensed under the MIT License - see the LICENSE file for details.