HOW-TO · DEV
How to use AI as a pair programmer by setting up real-time code suggestion with Claude in your editor
Target environment
Ubuntu 24.04 · Ollama 0.4.x
PREREQUISITES
VS Code or JetBrains IDE, Claude API access, basic familiarity with AI coding tools
What this does
This guide covers configuring a Claude-powered extension in VS Code or JetBrains to receive inline code suggestions as code is written. The extension analyzes the current file context and surrounding code to propose completions, refactoring suggestions, and boilerplate generation in real time, reducing the need to switch between an editor and a terminal or chat interface.
Steps
- Open the editor's extension marketplace and search for the official Claude extension (e.g., "Claude" by Anthropic). Install it.
- Open the extension settings via
Preferences > Extensions > Claude Configuration. - Enter the API endpoint URL. For cloud:
https://api.anthropic.com/v1/messages. For local Ollama:http://localhost:11434/api/chat. - Set the API key environment variable or enter it directly in the extension configuration field.
- Select the model variant (e.g.,
claude-3-5-sonnet-20240620for cloud,codellamafor Ollama). - Enable inline suggestions: set "Enable Inline Completion" to
trueand choose a keyboard shortcut for accepting suggestions (default:Tab). - Open a code file and trigger a suggestion by writing a function signature, comment, or partial implementation. Wait 1–2 seconds for the extension to analyze context and propose code.
- Press
Tabto accept,Escapeto dismiss, or modify the suggestion before accepting.
Verification
# Verify extension is loaded in VS Code
code --list-extensions | grep -i claude
# Expected output: anthropic.claude-code or similar official extension identifier
Common failures
- API key not recognized: Extension shows "Authentication failed" and no suggestions appear. Solution: confirm the API key is valid, environment variable is set in the shell before launching the editor, and no trailing whitespace is present in the key string.
- Suggestions timeout or hang: The extension spinner appears but never resolves. Solution: check network connectivity to the API endpoint with
curl -s -o /dev/null -w "%{http_code}" <endpoint>. If using Ollama, verify the service is running withcurl http://localhost:11434/api/tags. - Inline suggestion overrides cursor unexpectedly: Pressing
Tabto accept breaks indentation or moves the cursor to the wrong position. Solution: in extension settings, map the accept action to a custom shortcut (e.g.,Ctrl+Shift+Enter) rather thanTabto avoid conflicts with standard editor behavior. - Context window too short for large files: Suggestions are poor or generic because the extension only sends the visible viewport. Solution: open the file in a focused state or increase the token context limit in extension settings.