AI intermediate ⏱ 30 minutes

Continue.dev + Ollama: AI Code Assistant for Your IDE

GitHub Copilot alternative with local LLMs. Code completion, chat, and refactoring with complete privacy.

By homelabbing.io • 2025-12-16
#continue#copilot#code-assistant#ollama#vscode

Continue.dev is an open-source AI coding assistant that brings ChatGPT-style code generation and chat directly into VS Code and JetBrains IDEs. When paired with Ollama, you get a completely private, self-hosted alternative to GitHub Copilot and Cursor - with zero subscription fees and complete control over your data.

This guide shows you how to set up Continue.dev with Ollama, configure optimal models, create custom prompts for your workflow, and build an AI-powered development environment that runs entirely on your infrastructure.

What You’ll Learn:

  • Install Continue.dev in VS Code and JetBrains IDEs
  • Configure Ollama as the backend LLM provider
  • Choose and optimize models for code generation
  • Create custom slash commands and prompts
  • Use context providers for codebase-aware assistance
  • Build effective code generation workflows

Time Investment: 20 minutes for basic setup | 1-2 hours for advanced configuration

Hardware Requirements: 8GB RAM minimum (16GB+ recommended) | GPU optional but recommended


Understanding Continue.dev

What is Continue.dev?

Continue.dev is an open-source, IDE-integrated AI assistant that provides:

Core Features:

  • Inline Code Completion: GitHub Copilot-style autocomplete
  • Chat Interface: ChatGPT-like sidebar for questions and refactoring
  • Slash Commands: Quick actions like /edit, /test, /docs
  • Context Awareness: Understands your entire codebase
  • Multi-Model Support: Works with Ollama, OpenAI, Anthropic, local models
  • Customizable: Edit prompts, add custom commands, configure behavior
  • Privacy-First: Run completely offline with local models

Continue.dev vs Alternatives

FeatureContinue.dev + OllamaGitHub CopilotCursorCodeium
Privacy100% localCloud-basedCloud-basedCloud-based
Cost (annual)$0$120$240Free/Paid
OfflineYesNoNoNo
IDE SupportVS Code, JetBrainsVS Code, JetBrainsCursor onlyMultiple
Custom ModelsYesNoLimitedNo
Codebase ContextYesLimitedYesLimited

Installation

Step 1: Install Ollama

If you haven’t already:

# Linux/macOS
curl -fsSL https://ollama.ai/install.sh | sh

# Start service
systemctl start ollama
systemctl enable ollama

# Verify
curl http://localhost:11434/api/tags

See our Ollama guide for detailed setup.

Step 2: Install Continue.dev Extension

VS Code:

  1. Open VS Code
  2. Go to Extensions (Ctrl+Shift+X)
  3. Search “Continue”
  4. Click Install
  5. Reload VS Code

JetBrains (IntelliJ, PyCharm, etc.):

  1. File → Settings → Plugins
  2. Search “Continue”
  3. Install
  4. Restart IDE

Step 3: Configure Ollama Backend

First-time setup:

  1. Click Continue icon in sidebar (or Ctrl+L)
  2. Click gear icon (Settings)
  3. Opens ~/.continue/config.json

Replace with Ollama configuration:

{
  "models": [
    {
      "title": "DeepSeek Coder",
      "provider": "ollama",
      "model": "deepseek-coder:6.7b",
      "apiBase": "http://localhost:11434"
    },
    {
      "title": "CodeLlama",
      "provider": "ollama",
      "model": "codellama:7b",
      "apiBase": "http://localhost:11434"
    },
    {
      "title": "Llama 3.3",
      "provider": "ollama",
      "model": "llama3.3:8b",
      "apiBase": "http://localhost:11434"
    }
  ],
  "tabAutocompleteModel": {
    "title": "StarCoder",
    "provider": "ollama",
    "model": "starcoder2:3b",
    "apiBase": "http://localhost:11434"
  },
  "embeddingsProvider": {
    "provider": "ollama",
    "model": "nomic-embed-text",
    "apiBase": "http://localhost:11434"
  }
}

Save and reload Continue.dev

Step 4: Download Models

# Code generation (choose one)
ollama pull deepseek-coder:6.7b   # Best quality
ollama pull codellama:7b           # Good balance
ollama pull qwen2.5-coder:7b       # Fast

# Autocomplete (lightweight)
ollama pull starcoder2:3b

# Embeddings (for codebase context)
ollama pull nomic-embed-text

Download times:

  • 3B models: 2-5 minutes
  • 7B models: 5-10 minutes

Basic Usage

Chat Interface

Open Chat: Press Ctrl+L (or Cmd+L on Mac)

Ask Questions:

You: How do I read a JSON file in Python?

AI: To read a JSON file in Python, use the json module:

import json

with open('data.json', 'r') as f:
    data = json.load(f)

# data is now a Python dictionary
print(data['key'])

For writing:

with open('output.json', 'w') as f:
    json.dump(data, f, indent=2)

Code Explanation

Select code → Right-click → “Continue: Explain Code”

Or highlight code and press Ctrl+L, then type:

Explain this code

Code Editing

Highlight code → Ctrl+I (inline edit mode)

Prompt: Add error handling and logging

AI modifies code inline with:

  • Try/except blocks
  • Logging statements
  • Proper error messages

Slash Commands

Type / in chat to see available commands:

Common Commands:

/edit - Edit highlighted code
/test - Generate unit tests
/docs - Generate documentation
/fix - Fix errors or bugs
/comment - Add explanatory comments
/optimize - Improve performance

Example:

Highlight a function, then:

/test

AI generates comprehensive unit tests for that function.


Model Selection for Coding

Best Models for Different Tasks

Code Generation (Best Quality):

ollama pull deepseek-coder:33b  # Professional-grade (requires 20GB VRAM)
ollama pull deepseek-coder:6.7b # Excellent balance
ollama pull qwen2.5-coder:7b    # Very good, multilingual

Code Generation (Fast):

ollama pull codellama:7b        # Fast, good quality
ollama pull phi-3-mini          # Lightweight, decent quality

Autocomplete (Inline Suggestions):

ollama pull starcoder2:3b       # Best for autocomplete
ollama pull phi-3-mini          # Alternative, general-purpose

Code Explanation & Chat:

ollama pull llama3.3:8b         # Best general chat
ollama pull mistral:7b          # Fast alternative

8GB VRAM GPU:

{
  "models": [
    {
      "title": "DeepSeek Coder",
      "provider": "ollama",
      "model": "deepseek-coder:6.7b"
    }
  ],
  "tabAutocompleteModel": {
    "provider": "ollama",
    "model": "starcoder2:3b"
  }
}

16GB+ VRAM GPU:

{
  "models": [
    {
      "title": "DeepSeek Coder 33B",
      "provider": "ollama",
      "model": "deepseek-coder:33b"
    },
    {
      "title": "Qwen Coder",
      "provider": "ollama",
      "model": "qwen2.5-coder:14b"
    }
  ]
}

CPU-Only (No GPU):

{
  "models": [
    {
      "title": "Phi-3 Mini",
      "provider": "ollama",
      "model": "phi-3-mini"
    }
  ],
  "tabAutocompleteModel": {
    "provider": "ollama",
    "model": "phi-3-mini"
  },
  "disableAutocomplete": true  // Optional: disable for better performance
}

Advanced Configuration

Custom Slash Commands

Edit config.json:

{
  "slashCommands": [
    {
      "name": "homelab",
      "description": "Generate homelab infrastructure code",
      "prompt": "You are a homelab infrastructure expert. Generate {{{input}}} using Docker Compose, Kubernetes, or Ansible as appropriate. Include:\n- Security best practices\n- Resource limits\n- Health checks\n- Backup considerations\n\nCode:\n{{{code}}}"
    },
    {
      "name": "security",
      "description": "Security audit of code",
      "prompt": "Perform a security audit of this code:\n\n{{{code}}}\n\nCheck for:\n- SQL injection vulnerabilities\n- XSS vulnerabilities\n- Authentication/authorization issues\n- Secrets in code\n- Input validation\n\nProvide specific fixes."
    },
    {
      "name": "refactor",
      "description": "Refactor code for best practices",
      "prompt": "Refactor this code following best practices for {{{language}}}:\n\n{{{code}}}\n\nImprove:\n- Code organization\n- Naming conventions\n- Error handling\n- Performance\n- Readability"
    }
  ]
}

Usage:

/homelab a PostgreSQL database with automated backups
/security [highlight vulnerable code]
/refactor [highlight messy code]

Context Providers

Tell Continue.dev where to find context:

{
  "contextProviders": [
    {
      "name": "code",
      "params": {}
    },
    {
      "name": "docs",
      "params": {
        "sites": [
          "https://docs.python.org/3/",
          "https://kubernetes.io/docs/",
          "https://docs.ansible.com/"
        ]
      }
    },
    {
      "name": "folder",
      "params": {
        "folders": [
          "src/",
          "tests/",
          "docs/"
        ]
      }
    },
    {
      "name": "gitlab",
      "params": {
        "token": "your-gitlab-token",
        "domain": "gitlab.yourdomain.com"
      }
    }
  ]
}

Reference context in chat:

@code How does authentication work?
@docs kubernetes How do I configure ingress?
@folder tests/ Generate test for this

Custom Prompts & System Messages

Configure model behavior:

{
  "models": [
    {
      "title": "Homelab Coder",
      "provider": "ollama",
      "model": "deepseek-coder:6.7b",
      "systemMessage": "You are an expert in homelab infrastructure and self-hosted services. When generating code:\n- Prioritize Docker and Docker Compose\n- Include security best practices\n- Add comprehensive error handling\n- Provide resource limits\n- Include health checks and restart policies\n- Focus on reliability and maintainability"
    }
  ]
}

Now all responses follow your guidelines.


Practical Workflows

Workflow 1: Feature Implementation

Task: Add user authentication to a Flask app

Step 1: Describe in chat

I need to add user authentication to my Flask app with:
- Login/logout endpoints
- Password hashing
- Session management
- Protected routes

Step 2: AI generates code structure

Step 3: Use /edit to refine specific functions

Step 4: Use /test to generate tests

Step 5: Use /docs to document the feature

Result: Complete, tested, documented feature in 15 minutes vs 2 hours manually.

Workflow 2: Debugging

Step 1: Highlight buggy code

Step 2: Chat:

This function crashes with KeyError. Debug and fix.

Step 3: AI identifies issue and provides fix

Step 4: Apply fix inline with /edit

Step 5: Generate test case with /test to prevent regression

Workflow 3: Code Review Assistant

Step 1: Select entire file

Step 2: Custom /security slash command

Step 3: Review AI findings

Step 4: Apply suggested fixes with /edit

Step 5: Verify with /test

Workflow 4: Documentation Generation

Step 1: Select undocumented function/class

Step 2: /docs

Step 3: AI generates:

  • Function docstrings
  • Parameter descriptions
  • Return value docs
  • Example usage

Codebase Indexing

Enable Codebase-Aware Assistance

Configure embeddings:

{
  "embeddingsProvider": {
    "provider": "ollama",
    "model": "nomic-embed-text"
  }
}

Index your codebase:

  1. Click Continue sidebar
  2. Click “Index Codebase”
  3. Wait for embedding generation (1-10 minutes depending on size)

Use codebase context:

@codebase How does authentication work in this project?
@codebase Where is the database connection configured?
@codebase Show me all API endpoints

AI searches your entire codebase and provides contextual answers.

Periodic Re-indexing

Automatic (recommended):

{
  "embeddingsProvider": {
    "provider": "ollama",
    "model": "nomic-embed-text"
  },
  "reranker": {
    "name": "free-trial"
  },
  "docs": {
    "autoUpdate": true,
    "updateInterval": 86400  // Re-index daily
  }
}

Performance Optimization

Autocomplete Optimization

Reduce latency:

{
  "tabAutocompleteModel": {
    "provider": "ollama",
    "model": "starcoder2:3b",
    "apiBase": "http://localhost:11434"
  },
  "tabAutocompleteOptions": {
    "maxPromptTokens": 500,
    "debounceDelay": 300,
    "multilineCompletions": "auto"
  }
}

Disable if too slow:

{
  "disableAutocomplete": true
}

Model Loading

Keep model in memory:

# Configure Ollama to keep model loaded
export OLLAMA_KEEP_ALIVE=24h
systemctl restart ollama

Pre-warm model:

# Load model into memory
ollama run deepseek-coder:6.7b "test" --verbose false

Now first request is instant.

GPU Utilization

Verify GPU is used:

# While using Continue.dev
nvidia-smi

# Should show ollama process using GPU

If not detected:

# Restart Ollama with GPU
sudo systemctl stop ollama
CUDA_VISIBLE_DEVICES=0 ollama serve

Troubleshooting

Issue: Slow Responses

Solutions:

  1. Use smaller model: phi-3-mini or codellama:7b
  2. Verify GPU is active: nvidia-smi
  3. Reduce context: Limit highlighted code
  4. Pre-warm model (see Performance section)

Issue: Poor Code Quality

Solutions:

  1. Use better model: deepseek-coder:6.7b or larger
  2. Add system message with guidelines
  3. Provide more context in prompt
  4. Use codebase indexing for project-specific code

Issue: Connection Errors

Solution:

# Verify Ollama is running
curl http://localhost:11434/api/tags

# Restart if needed
systemctl restart ollama

# Check Continue.dev config
cat ~/.continue/config.json | grep apiBase

Issue: High Memory Usage

Solutions:

  1. Use smaller models
  2. Disable autocomplete
  3. Limit concurrent requests
  4. Configure Ollama memory limits

Next Steps

Customization Ideas

  • Create slash commands for your tech stack
  • Add project-specific documentation sites
  • Build custom prompts for your coding style
  • Integrate with CI/CD for automated reviews

Learning Path

Week 1: Use chat for questions and explanations Week 2: Master slash commands (/edit, /test, /docs) Week 3: Configure custom commands and prompts Week 4: Enable codebase indexing and context providers

Guide Version: 1.0 Last Updated: December 2024 Difficulty: Intermediate Time to Complete: 20-30 minutes