An IntelliJ plugin that provides AI-powered code completions using locally running Ollama LLM with an efficient caching system.
- Real-time code suggestions using local Ollama LLM
- Intelligent prefix-based caching system for performance optimization
- Inline completion rendering using IntelliJ's Inline Completion API
- Support for multiple programming languages
- IntelliJ IDEA 2023.1 or newer
- Ollama installed locally with the
codellama:7b-codemodel
- Download and install Ollama for your operating system
- Pull the CodeLlama model:
ollama pull codellama:7b-code- Ensure Ollama server is running:
ollama serve- Download the ZIP archive from the Releases section
- In IntelliJ IDEA, go to:
Settings/Preferences→Plugins→ ⚙️ →Install Plugin from Disk...
- Select the downloaded ZIP file
- Restart the IDE
- Clone the repository
- Open the project in IntelliJ IDEA
- Run the plugin using ./gradlew runIde
Once installed and with Ollama running locally:
- Open any code file in IntelliJ IDEA
- Start typing code as usual
- The plugin will automatically suggest completions that appear as inline gray text
- Press Tab to accept the suggestion, or continue typing to ignore it
The plugin connects to your locally running Ollama server to generate code completions based on the current file context. It sends the code prefix (everything before the cursor) to the Ollama API and displays the generated completion.
The plugin implements an efficient trie-based caching system that:
- Stores prefixes and their completions in a trie data structure
- Enables partial matching so shorter prefixes can reuse results of longer queries
- Employs a modified LRU eviction strategy that:
- Identifies the least recently used completions (bottom 10%)
- Evicts the shortest completion from this pool
- Prioritizes retention of longer, more valuable completions
This approach maximizes cache hits while maintaining reasonable memory usage, significantly reducing the number of API calls to the LLM.
Future improvements planned for this plugin:
- Settings menu for configuring options (model selection, temperature, etc.)
- Status bar indicator showing plugin status and completion statistics
- SimHash-based backup cache strategy for approximate matching
- Support for more Ollama models and customization options
Feedback and contributions are welcome! Please feel free to submit issues or pull requests on the GitHub repository.
This project is licensed under the MIT License - see the LICENSE file for details.