Skip to main content

Overview

Continue.dev is an open-source AI coding assistant for VS Code. This guide shows how to integrate Pylance MCP for enhanced Python support.

Prerequisites

  • Visual Studio Code
  • Continue.dev extension installed
  • Pylance MCP Server
  • OpenAI or Anthropic API key

Installation

1

Install Continue.dev

Install from VS Code Marketplace:
Extensions → Search "Continue" → Install
2

Install Pylance MCP

pip install pylance-mcp-server
3

Configure Continue

Open Continue config: Cmd/Ctrl+Shift+P → “Continue: Open config.json”
config.json
{
  "models": [{
    "title": "GPT-4",
    "provider": "openai",
    "model": "gpt-4",
    "apiKey": "YOUR_OPENAI_KEY"
  }],
  "mcpServers": [{
    "name": "pylance",
    "command": "python",
    "args": ["-m", "pylance_mcp.server"],
    "env": {
      "PYLANCE_WORKSPACE": "${workspaceFolder}"
    }
  }]
}
4

Reload VS Code

Cmd/Ctrl+Shift+P → Developer: Reload Window

Usage

Inline Completion

Start typing and Continue suggests completions:
def fetch_user_  # Press Tab
# → def fetch_user_by_id(user_id: int) -> Optional[User]:

Chat with Context

Open Continue sidebar (Cmd/Ctrl+L) and ask:
@pylance Explain the database schema in models/

Code Actions

Highlight code → Right-click → Continue:
  • Explain Code: Get detailed explanation
  • Refactor: Suggest improvements
  • Fix Bugs: Identify and fix issues
  • Add Tests: Generate unit tests
  • Add Docs: Generate docstrings

Configuration Options

Custom LLM Provider

Use Claude instead of GPT-4:
config.json
{
  "models": [{
    "title": "Claude 3 Opus",
    "provider": "anthropic",
    "model": "claude-3-opus-20240229",
    "apiKey": "YOUR_ANTHROPIC_KEY"
  }],
  "mcpServers": [{
    "name": "pylance",
    "command": "python",
    "args": ["-m", "pylance_mcp.server"]
  }]
}

Multiple Workspaces

config.json
{
  "mcpServers": [
    {
      "name": "pylance-backend",
      "command": "python",
      "args": ["-m", "pylance_mcp.server"],
      "env": {
        "PYLANCE_WORKSPACE": "/workspace/backend"
      }
    },
    {
      "name": "pylance-frontend",
      "command": "python",
      "args": ["-m", "pylance_mcp.server"],
      "env": {
        "PYLANCE_WORKSPACE": "/workspace/frontend"
      }
    }
  ]
}

Remote Server

config.json
{
  "mcpServers": [{
    "name": "pylance",
    "url": "https://api.pylancemcp.dev",
    "headers": {
      "Authorization": "Bearer ${PYLANCE_API_KEY}"
    }
  }]
}

Advanced Features

Custom Slash Commands

Define shortcuts for common tasks:
config.json
{
  "slashCommands": [
    {
      "name": "review",
      "description": "Review code for issues",
      "prompt": "@pylance Review this code for bugs, type errors, and style issues:\n\n{{{ input }}}"
    },
    {
      "name": "tests",
      "description": "Generate pytest tests",
      "prompt": "@pylance Generate comprehensive pytest tests for:\n\n{{{ input }}}"
    },
    {
      "name": "docs",
      "description": "Add documentation",
      "prompt": "@pylance Add Google-style docstrings to:\n\n{{{ input }}}"
    }
  ]
}
Usage: Type /review in Continue chat

Context Providers

Include additional context:
config.json
{
  "contextProviders": [
    {
      "name": "code",
      "params": {
        "includeTypes": ["py", "pyi"],
        "maxFiles": 50
      }
    },
    {
      "name": "docs",
      "params": {
        "urls": [
          "https://docs.python.org/3/",
          "https://fastapi.tiangolo.com/"
        ]
      }
    }
  ]
}

Keyboard Shortcuts

keybindings.json
[
  {
    "key": "cmd+i",
    "command": "continue.acceptCompletion"
  },
  {
    "key": "cmd+shift+i",
    "command": "continue.rejectCompletion"
  },
  {
    "key": "cmd+l",
    "command": "continue.openChat"
  }
]

Examples

Code Review

/review

def process_payment(amount, card_number):
    # Charge the card
    result = stripe.charge(amount, card_number)
    return result
Continue responds:
Issues found:
1. Missing type hints
2. No input validation
3. card_number should not be raw string
4. No error handling
5. Missing docstring

Suggested fix:
[shows improved code]

Test Generation

/tests

class UserService:
    def create_user(self, email: str, password: str) -> User:
        hashed = hash_password(password)
        return User(email=email, password_hash=hashed)
Continue generates:
import pytest
from unittest.mock import Mock, patch

def test_create_user_success():
    service = UserService()
    with patch('hash_password') as mock_hash:
        mock_hash.return_value = "hashed_pw"
        user = service.create_user("test@example.com", "password123")
        assert user.email == "test@example.com"
        assert user.password_hash == "hashed_pw"
        mock_hash.assert_called_once_with("password123")

def test_create_user_invalid_email():
    service = UserService()
    with pytest.raises(ValueError):
        service.create_user("invalid-email", "password123")

Troubleshooting

  • Check Python interpreter is selected
  • Verify workspace folder is open
  • Ensure files are saved
  • Check Continue logs: OutputContinue
  • Increase memory limit in config
  • Reduce maxFiles in context providers
  • Check Python version compatibility (3.9+)
  • Disable unnecessary context providers
  • Reduce workspace scope
  • Use diagnosticMode: "openFilesOnly"

Best Practices

Use descriptive names in chat for better context
Highlight relevant code before asking questions
Reference specific files with @filename
Use slash commands for repetitive tasks

Next Steps