Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>Ollama Code AgentNew to Visual Studio Code? Get it now.
Ollama Code Agent

Ollama Code Agent

Arulb2w

|
4 installs
| (0) | Free
AI-powered code generation agent using local Ollama models (CodeLlama, DeepSeek Coder, Llava)
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Ollama Code Agent - VS Code Extension

A free, local AI-powered code generation agent for Visual Studio Code using Ollama.

Features

  • Inline Code Completion - Get AI-powered code suggestions as you type
  • Chat Panel with Copilot-Style Modes - Switch between ⚡ Agent (auto-creates files on prompt/response) and 💬 Ask (Q&A mode)
  • Model Selector Dropdown in Chat - Switch between installed Ollama models directly inside the chat header UI
  • Autonomous File Creation - Automatically creates, writes, and opens files in your workspace root when Agent mode is active or when you request file creation
  • Image & Screenshot Support - Paste (Ctrl+V), drag & drop, or attach images into chat for multimodal AI vision models (e.g. llava, llama3.2-vision)
  • Code from Comments - Generate code implementations from natural language comments (Ctrl+Shift+G)
  • Fully Local & Free - All processing happens on your machine, no API keys needed

Prerequisites

  1. Install Ollama: Download from ollama.ai
  2. Pull a coding model:
    # Recommended models for code generation:
    ollama pull deepseek-coder:6.7b    # Best balance of speed/quality
    ollama pull codellama:7b            # Meta's code model
    ollama pull starcoder2:7b           # BigCode's model
    
  3. Ensure Ollama is running: The Ollama service must be running (default: http://localhost:11434)

Installation

From Source

cd C:\Arul\Projects\VCode\VSCodeAgentPlugin
npm install
npm run compile

Then press F5 in VS Code to launch the extension in debug mode.

Run the extension-host checks with:

npm test

Package as VSIX

npm run package

Then install the .vsix file via VS Code: Extensions → ⋯ → Install from VSIX.

Usage

Inline Completion

Simply start typing code — the extension will suggest completions after a brief pause. Press Tab to accept.

Chat Panel

  1. Click the Ollama icon in the Activity Bar (left sidebar)
  2. Type your coding question and press Enter
  3. Click "Insert" on any code block to paste it into your editor

Generate Code from Comments

  1. Write a comment describing what you want:
    # Function to calculate fibonacci numbers recursively with memoization
    
  2. Place your cursor on or below the comment
  3. Press Ctrl+Shift+G (or run command "Ollama: Generate Code from Comment")

Select Model

Run command "Ollama: Select Model" to pick from your installed Ollama models.

Configuration

Setting Default Description
ollamaCodeAgent.endpoint http://localhost:11434 Ollama API endpoint
ollamaCodeAgent.model deepseek-coder:6.7b Model for code generation
ollamaCodeAgent.enableInlineCompletion true Enable/disable inline suggestions
ollamaCodeAgent.maxTokens 512 Max tokens per generation
ollamaCodeAgent.temperature 0.2 Creativity (0=deterministic, 1=creative)
ollamaCodeAgent.maxTokensChat 1024 Max tokens per chat response
ollamaCodeAgent.debounceTime 500 Delay before inline completions, in milliseconds
ollamaCodeAgent.contextLines.completion 50 Preceding lines sent with inline completion requests
ollamaCodeAgent.contextLines.comment 10 Preceding lines sent with comment generation requests
ollamaCodeAgent.autoCreateFiles true Offer to create files from Agent responses

Agent responses are always confirmed before files are written, and generated paths must remain inside the open workspace.

Recommended Models

Model Size Best For
deepseek-coder:6.7b ~4GB General code completion & generation
codellama:7b ~4GB Code completion, multi-language
codellama:13b ~7GB Higher quality, slower
starcoder2:7b ~4GB Code completion
deepseek-coder:1.3b ~1GB Fast completions on limited hardware

Troubleshooting

  • "Cannot connect to Ollama": Ensure Ollama is running (ollama serve)
  • Slow completions: Try a smaller model like deepseek-coder:1.3b
  • No suggestions appearing: Check that inline completion is enabled in settings

License

MIT

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft