-
Notifications
You must be signed in to change notification settings - Fork 0
Completion Configuration
Status: ✅ Complete
Phase: Phase 3 - MVP Features
Last Updated: December 4, 2025
Code Completion behavior is configured through YAML configuration files. This guide explains all configuration options and how to customize completion for your needs.
Configuration files are loaded in this order (later overrides earlier):
- Built-in Defaults: Default configuration for each language
-
User Configuration:
~/.ricecoder/completion.yaml -
Project Configuration:
.ricecoder/completion.yaml - Runtime Overrides: CLI flags or API calls
# Enable/disable completion
enabled: true
# Maximum number of suggestions to return
max_suggestions: 20
# Timeout for completion generation (milliseconds)
timeout_ms: 100
# Enable ghost text (inline suggestions)
ghost_text:
enabled: true
style: "lighter" # lighter, italic, dimmed
# Track completion usage for frequency/recency scoring
track_frequency: true
# Language-specific configurations
languages:
rust: { ... }
typescript: { ... }
python: { ... }Each language can define:
languages:
rust:
# Enable/disable for this language
enabled: true
# Language-specific keywords
keywords:
- fn
- let
- mut
- struct
- impl
- trait
# Code snippets
snippets:
- label: "fn main"
template: "fn main() {\n ${1}\n}"
description: "Main function"
# Ranking weights
ranking_weights:
relevance: 0.5
frequency: 0.3
recency: 0.2
# Reference to language-specific provider
provider: "rust"Enable or disable completion globally.
enabled: true # Default: trueMaximum number of suggestions to return.
max_suggestions: 20 # Default: 20, Range: 1-100Timeout for completion generation in milliseconds.
timeout_ms: 100 # Default: 100, Range: 50-500Ghost text (inline suggestion) configuration.
ghost_text:
enabled: true # Default: true
style: "lighter" # Default: "lighter", Options: lighter, italic, dimmedTrack completion usage for frequency and recency scoring.
track_frequency: true # Default: trueEnable or disable completion for a specific language.
languages:
rust:
enabled: true # Default: trueLanguage-specific keywords to suggest.
languages:
rust:
keywords:
- fn
- let
- mut
- struct
- impl
- trait
- match
- if
- for
- whileCode snippets for common patterns.
languages:
rust:
snippets:
- label: "fn main"
template: "fn main() {\n ${1}\n}"
description: "Main function"
- label: "println!"
template: "println!(\"${1}\");"
description: "Print macro"Snippet placeholders:
-
${1},${2}, etc.: Tab stops for cursor positioning -
${1:default}: Tab stop with default value -
$0: Final cursor position
Weights for different scoring factors (must sum to 1.0).
languages:
rust:
ranking_weights:
relevance: 0.5 # How well completion matches context
frequency: 0.3 # How often completion is used
recency: 0.2 # How recently completion was usedReference to language-specific provider.
languages:
rust:
provider: "rust" # Built-in: rust, typescript, python, generic# ~/.ricecoder/completion.yaml
enabled: true
max_suggestions: 20# .ricecoder/completion.yaml
enabled: true
max_suggestions: 30
languages:
rust:
enabled: true
keywords:
- fn
- let
- mut
- struct
- impl
- trait
- match
ranking_weights:
relevance: 0.6
frequency: 0.2
recency: 0.2
provider: "rust"
typescript:
enabled: false # Disable TypeScript# .ricecoder/completion.yaml
enabled: true
max_suggestions: 20
ghost_text:
enabled: true
style: "lighter"
languages:
rust:
enabled: true
provider: "rust"
ranking_weights:
relevance: 0.5
frequency: 0.3
recency: 0.2
typescript:
enabled: true
provider: "typescript"
ranking_weights:
relevance: 0.5
frequency: 0.3
recency: 0.2
python:
enabled: true
provider: "python"
ranking_weights:
relevance: 0.5
frequency: 0.3
recency: 0.2# .ricecoder/completion.yaml
languages:
rust:
snippets:
- label: "Result type"
template: "Result<${1:T}, ${2:E}>"
description: "Result type with generics"
- label: "Option type"
template: "Option<${1:T}>"
description: "Option type with generic"
- label: "match statement"
template: "match ${1:expr} {\n ${2:pattern} => ${3:value},\n}"
description: "Match statement template"Configuration files are validated on load. Invalid configuration will be rejected with clear error messages.
Error: Configuration error: missing required field 'language'
Solution: Ensure all required fields are present in configuration.
Error: Configuration error: ranking weights must sum to 1.0
Solution: Ensure relevance + frequency + recency = 1.0
Error: Configuration error: unknown provider 'custom'
Solution: Use built-in providers: rust, typescript, python, generic
Error: Configuration error: timeout must be between 50 and 500 ms
Solution: Set timeout between 50 and 500 milliseconds.
# Enable/disable completion
ricecoder config completion.enabled true
ricecoder config completion.enabled false
# Set maximum suggestions
ricecoder config completion.max_suggestions 30
# Set timeout
ricecoder config completion.timeout_ms 150
# Enable/disable ghost text
ricecoder config completion.ghost_text.enabled true
# Set ghost text style
ricecoder config completion.ghost_text.style "italic"
# Enable/disable language
ricecoder config completion.languages.rust.enabled true
# Set ranking weights
ricecoder config completion.languages.rust.ranking_weights.relevance 0.6use ricecoder_completion::config::*;
// Load configuration
let config = ConfigLoader::load_from_file("~/.ricecoder/completion.yaml")?;
// Modify configuration
let mut config = config;
config.enabled = true;
config.max_suggestions = 30;
// Save configuration
config.save_to_file("~/.ricecoder/completion.yaml")?;Use default configuration and customize only what you need:
# Good: Minimal customization
enabled: true
max_suggestions: 20
# Avoid: Over-configuration
enabled: true
max_suggestions: 20
ghost_text:
enabled: true
style: "lighter"
track_frequency: true
languages:
rust:
enabled: true
keywords: [...]
snippets: [...]
ranking_weights: {...}
provider: "rust"Store project-specific configuration in .ricecoder/completion.yaml:
# .ricecoder/completion.yaml
# Project-specific completion settings
languages:
rust:
snippets:
- label: "project-specific snippet"
template: "..."Tune ranking weights based on your preferences:
# Prefer relevance over frequency
ranking_weights:
relevance: 0.7
frequency: 0.2
recency: 0.1
# Prefer frequency over relevance
ranking_weights:
relevance: 0.3
frequency: 0.5
recency: 0.2Disable languages you don't use to improve performance:
languages:
rust:
enabled: true
typescript:
enabled: false # Not using TypeScript
python:
enabled: false # Not using PythonAdd project-specific snippets:
languages:
rust:
snippets:
- label: "project error type"
template: "ProjectError::${1:Variant}"
description: "Project-specific error type"- Code Completion - Completion feature guide
- Configuration Guide - General configuration guide
- Troubleshooting - Troubleshooting guide
Last updated: December 4, 2025