Inline Code Completion
Ghost-text completions as you type. Local-first by default — Ollama + qwen2.5-coder → fast, private, zero cloud cost. Any of 9 providers can back it.
graph TB
A[Keystroke] --> B[Debounce 300 ms]
B --> C[Context gathering<br/>prefix + suffix + imports via Tree-sitter]
C --> D[FIM prompt builder<br/>model-specific tokens]
D --> E[LLM provider]
E --> F[Ghost text in editor]
Steps:
- Debounce — waits configured delay (default 300 ms) after you stop typing. Prevents excessive API calls during rapid typing.
- Context —
ContextCompletionServicecaptures prefix (~8000 chars / 2000 tokens), suffix (~2000 chars / 500 tokens), imports via Tree-sitter AST (TypeScript, JavaScript, Python). - FIM prompt —
FIMPromptServicewraps context in model-specific Fill-in-the-Middle tokens. No FIM support → falls back to prefix-only prompt. - Send — result cached (LRU, 50 entries) so identical contexts don’t re-request.
- Display — appears as ghost text.
Tabaccepts.
Fill-in-the-Middle tokens
Section titled “Fill-in-the-Middle tokens”FIM-capable models mark prefix / suffix / fill position with special tokens:
| Model family | Prefix | Suffix | Middle | EOT |
|---|---|---|---|---|
| Qwen (default) | <|fim_prefix|> | <|fim_suffix|> | <|fim_middle|> | <|endoftext|> |
| DeepSeek | <|fim_begin|> | <|fim_hole|> | <|fim_end|> | <|end_of_text|> |
| CodeLlama | <PRE> | <SUF> | <MID> | <EOT> |
| StarCoder / Codestral | <fim_prefix> | <fim_suffix> | <fim_middle> | <|endoftext|> |
Non-FIM models receive prefix text only → generate next-likely tokens.
Settings
Section titled “Settings”| Setting | Default | Purpose |
|---|---|---|
codebuddy.completion.enabled | true | Master toggle |
codebuddy.completion.provider | "Local" | Provider — Gemini, Groq, Anthropic, DeepSeek, OpenAI, Qwen, GLM, Local |
codebuddy.completion.model | "qwen2.5-coder" | Model name |
codebuddy.completion.apiKey | "" | Overrides provider key (falls back if empty) |
codebuddy.completion.debounceMs | 300 | Trigger delay (min 50) |
codebuddy.completion.maxTokens | 128 | Max tokens per completion |
codebuddy.completion.triggerMode | "automatic" | automatic (as you type) or manual |
codebuddy.completion.multiLine | true | Allow multi-line completions |
Commands
Section titled “Commands”| Command | Effect |
|---|---|
| Toggle Inline Completions | Flips codebuddy.completion.enabled |
| Configure Completion Settings | Opens settings filtered to codebuddy.completion.* |
Status bar
Section titled “Status bar”$(zap) CodeBuddy: qwen2.5-coder— enabled, active model shown$(circle-slash) CodeBuddy: Off— disabled
Click to open completion settings.
Provider matrix
Section titled “Provider matrix”| Provider | Endpoint | FIM support |
|---|---|---|
| Local (default) | http://localhost:11434/v1 | Yes (Qwen, DeepSeek, CodeLlama, StarCoder) |
| Groq | api.groq.com | Depends on model |
| OpenAI | api.openai.com | No (chat fallback) |
| Anthropic | Anthropic SDK | No (chat fallback) |
| Gemini | Google AI SDK | No (chat fallback) |
| DeepSeek | api.deepseek.com | Yes |
| Qwen | dashscope-intl.aliyuncs.com | Yes |
| GLM | open.bigmodel.cn | Depends on model |
File types
Section titled “File types”Completions work in all file types — provider registered with { pattern: "**" }. Import extraction via Tree-sitter covers TypeScript, JavaScript, Python. Other languages get prefix + suffix without import signatures.
Related
Section titled “Related”- Local models — default provider for completions
- Context system — the lighter pipeline this uses