Skip to content

Latest commit

 

History

History
200 lines (148 loc) · 7.7 KB

File metadata and controls

200 lines (148 loc) · 7.7 KB

popoCompletionAI

🚀 AI-Powered Inline Code Completion for IntelliJ IDEA
Type code, get suggestions. Ask questions in comments, get answers.

Stars Release License IntelliJ


What is popoCompletionAI?

popoCompletionAI is a lightweight IntelliJ IDEA plugin that brings DeepSeek V4 AI code completion directly into your editor. It shows ghost text suggestions as you type — just like GitHub Copilot, but powered by DeepSeek's latest models.

💡 Works offline? No, it calls the DeepSeek API. You need an API key from platform.deepseek.com.

🤦 Why I Built This

The built-in code completion models in my IDE were just too dumb. They'd suggest random variable names, ignore my project context, and couldn't handle even basic logic. I got tired of hitting Tab only to immediately undo. So I decided: if the local models can't cut it, let's bring in DeepSeek V4 — a 1M-context model that actually understands your codebase. This plugin replaces the garbage inline suggestions with real AI-powered completions that know your types, your classes, and your intent.


✨ Features

🧠 Smart Inline Completion

As you type, ghost text suggestions appear at the cursor. Press Tab to accept, Esc to dismiss, or keep typing to override.

public class UserService {
    private final UserDao userDao
    //              ↑ ghost text: = new UserDao();
}

💬 Comment-to-Answer

Write a question inside a code comment — popoCompletionAI detects the intent and answers inline.

// Why does this overlap split fail?
// → The overlap doesn't split because you're passing the
//   same object reference. Try creating a new instance.

Works in //, /* */, #, and -- comments. Supports both Chinese and English.

📂 Cross-File Context Awareness

Automatically reads imported classes and same-package files to understand your project context. The model sees the full implementation of your dependencies, not just method signatures.

⚡ Built for Speed

  • 100ms debounce for questions (respond instantly)
  • 300ms debounce for code (balance API usage and responsiveness)
  • java.net.http.HttpClient — zero extra dependencies
  • Plugin size: 1.6 MB only

📦 Installation

From ZIP (recommended)

  1. Download the latest .zip from Releases
  2. Open IntelliJ IDEA → SettingsPlugins → ⚙️ → Install Plugin from Disk
  3. Select the zip file and restart your IDE

From Source

git clone https://github.com/coder-mtj/popoCompletionAI.git
cd popoCompletionAI
./gradlew buildPlugin
# Artifact: build/distributions/DeepSeekInLineCompletion-*.zip

🌐 Multi-Provider Support

popoCompletionAI uses OpenAI-compatible APIs under the hood. By changing the Base URL and Model in settings, you can use it with virtually any provider:

Provider Base URL Model Example
DeepSeek (default) https://api.deepseek.com deepseek-v4-pro / deepseek-v4-flash
OpenAI https://api.openai.com gpt-4o / gpt-4o-mini
Ollama (local) http://localhost:11434 codellama:7b / deepseek-coder:6.7b
LM Studio (local) http://localhost:1234 local-model
vLLM / TGI http://your-server:8000 whatever model you serve
Any OpenAI-compatible proxy your proxy URL your model name

⚠️ The provider must support both /beta/completions (or /v1/completions) for code FIM and /chat/completions for Q&A. Most OpenAI-compatible servers support at least chat completions. For pure code completion without Q&A, FIM support is all you need.


⚙️ Configuration

After installation, go to Settings → Tools → DeepSeek Completion:

Setting Description Default
API Key DeepSeek API key (get one here)
Base URL API endpoint (change for other providers) https://api.deepseek.com
Model Language model deepseek-v4-pro
Max Tokens Max output per completion (1–4000) 512
Include Context Read imported files for context ✅ On

💡 You can also set the environment variable DEEPSEEK_API_KEY instead of entering it in settings.


🧠 How It Works

You type
    │
    ▼
Intent Detection ──→ CODE? ──→ FIM API (/beta/completions)
    │                    "DeepSeek, fill between prefix and suffix"
    └──→ QUESTION? ──→ Chat API (/chat/completions)
                         "DeepSeek, answer this question about the code"
    │
    ▼
Context Builder
├── PSI structure (class name, fields, methods)
├── 200K chars prefix + 50K chars suffix
└── Full content of imported project files (up to 5 files)
    │
    ▼
Post-Processing
├── Anti-dupe (prevents "privateprivate var")
├── Bracket balancing
├── Comment boundary detection
└── Smart stop tokens from suffix
    │
    ▼
Ghost text rendered → Tab = Accept

FIM (Fill-in-the-Middle) Explained

┌────────────┐     ┌────────────┐     ┌────────────┐
│  prefix    │ →   │  model     │  ←  │  suffix    │
│ (code      │     │ generates  │     │ (code      │
│  before    │     │  the gap)  │     │  after     │
│  cursor)   │     └────────────┘     │  cursor)   │
└────────────┘                        └────────────┘

📁 Project Structure

src/main/kotlin/com/deepseek/plugin/
├── DeepSeekInlineCompletionProvider.kt   ← Plugin entry point
├── DeepSeekFimClient.kt                 ← HTTP client (FIM + Chat APIs)
├── DeepSeekFimModels.kt                 ← API request/response models
├── CompletionContextBuilder.kt          ← PSI-based context builder
├── IntentDetector.kt                    ← Intent detection engine
├── CodeCompletionInsertHandler.kt       ← Tab-accept handler
├── DeepSeekSettingsState.kt             ← Persistent settings
└── DeepSeekSettingsConfigurable.kt      ← Settings panel UI

🔧 Development

# Compile only
./gradlew compileKotlin

# Build plugin zip
./gradlew buildPlugin

# Launch sandbox IDE for testing
./gradlew runIde

Requirements: JDK 21, Gradle 8.13+


🙏 Support This Project

If this plugin helps you code faster, please consider:

  • Star this repo — it helps others discover it!
  • 🐛 Report bugs via Issues
  • 💡 Suggest features in Discussions
  • 🔀 Open a PR — contributions are welcome!

📄 License

MIT © 2026 coder-mtj