HOW-TO · DEV

How to use AI as a pair programmer by setting up real-time code suggestion with Claude in your editor

intermediate15 minBy Eruo Fredoline
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

  1. Open the editor's extension marketplace and search for the official Claude extension (e.g., "Claude" by Anthropic). Install it.
  2. Open the extension settings via Preferences > Extensions > Claude Configuration.
  3. Enter the API endpoint URL. For cloud: https://api.anthropic.com/v1/messages. For local Ollama: http://localhost:11434/api/chat.
  4. Set the API key environment variable or enter it directly in the extension configuration field.
  5. Select the model variant (e.g., claude-3-5-sonnet-20240620 for cloud, codellama for Ollama).
  6. Enable inline suggestions: set "Enable Inline Completion" to true and choose a keyboard shortcut for accepting suggestions (default: Tab).
  7. 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.
  8. Press Tab to accept, Escape to 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

  1. 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.
  2. 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 with curl http://localhost:11434/api/tags.
  3. Inline suggestion overrides cursor unexpectedly: Pressing Tab to 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 than Tab to avoid conflicts with standard editor behavior.
  4. 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.

Related guides