Overview
Code completion provides natural, context-aware code suggestions as you type in Xcode. This brings AI-powered autocomplete to your Swift development workflow, helping you write code faster and with fewer errors.Supported Providers
cmd supports code completion from three leading providers:GitHub Copilot
Use your existing GitHub Copilot subscription for code suggestions
Mistral AI
Fast and accurate completions powered by Mistral’s Codestral model
Mercury Coder
Inception’s Mercury Coder for thoughtful, context-aware suggestions
Configuration
1
Open Settings
Navigate to Settings in cmd
2
Select Code Completion
Find the Code Completion section
3
Choose a Provider
Select your preferred completion provider:
- GitHub Copilot: Requires a GitHub Copilot subscription
- Mistral AI: Requires a Mistral API key
- Claude: Uses your configured Anthropic API key
4
Configure Trigger Mode
Choose when completions should appear:
- Automatic: Suggestions appear as you type
- On Demand: Trigger suggestions manually with a keyboard shortcut
Provider Setup
GitHub Copilot
1
Sign In
Click Sign in with GitHub in the Code Completion settings
2
Authorize
Complete the GitHub OAuth flow to authorize cmd
3
Verify Subscription
Ensure you have an active GitHub Copilot subscription (Individual, Business, or Enterprise)
GitHub Copilot requires an active subscription. Visit github.com/features/copilot to subscribe.
Mistral AI / Mercury Coder
1
Get API Key
Create an API key at console.mistral.ai
2
Add to cmd
Enter your Mistral API key in Settings > AI Providers
3
Select Mistral
Choose Mistral AI as your code completion provider
Trigger Modes
Automatic Mode
In automatic mode, code completions appear as you type after a brief pause. This provides a seamless experience where suggestions flow naturally with your coding rhythm.- Suggestions appear automatically after you stop typing
- Minimal interruption to your workflow
- Best for developers who want continuous assistance
On-Demand Mode
In on-demand mode, you control when completions appear by pressing a keyboard shortcut.- Trigger completions only when you want them
- Less visual noise while coding
- Best for developers who prefer explicit control
Using Code Completion
Once configured, code completion works seamlessly in Xcode:- Start typing in any Swift file
- View suggestions that appear inline as ghost text
- Accept a suggestion by pressing
Tab - Dismiss a suggestion by pressing
Escapeor continuing to type
Best Practices
Write Clear Comments
Add comments describing what you want to implement. Code completion uses these as context for better suggestions.
Use Meaningful Names
Descriptive function and variable names help the AI understand your intent and provide more relevant completions.

