AD SPACE AVAILABLE · BRAND PARTNERS WELCOME

Configuring Qwen2.5-Coder in VS Code for Offline Autocomplete and Test Generation

片山和佳子 · 365Finds Editorial
Indexed 88,650 Wiki articles

Put 365 Wiki to work with your AI

Copy the prompt below, paste it into the AI you already use, then ask your question.

Download full Skill

Try it with the prompt first. If you use 365 Wiki often, install the full 365Wiki Skill so you do not have to paste it again. No regular AI? Gemini or Microsoft Copilot on the web will work.

365Wiki Skill

If your source code cannot leave your workstation due to compliance, NDAs, or plain developer paranoia, cloud-based assistants like GitHub Copilot or Cursor are immediate non-starters. The most capable fully offline alternative available today is running Alibaba Cloud's Tongyi Qianwen coding model family—specifically Qwen2.5-Coder—on a local inference engine and binding it to Visual Studio Code through the Continue extension.

At 365Finds, our testing leads us to an uncompromising recommendation: do not attempt to run a single model for both inline autocomplete and chat-driven test generation. Inline tab completion demands sub-200-millisecond latency to avoid disrupting flow state, while generating robust edge-case unit tests requires deeper parametric reasoning. The optimal local setup pairs a lightweight 1.5B parameter model for tab completion with a 7B (or 14B) parameter model for chat and inline code edits.

Here is the exact setup path to make this work completely offline.


Step 1: Install Ollama and Pull the Dual-Model Pair

Ollama remains the cleanest local model runtime for macOS, Linux, and Windows with WSL2 or native GPU acceleration.

First, ensure Ollama is installed and running:

ollama --version

Next, pull the two models. The 1.5b model will handle instantaneous ghost-text completions, while the 7b model will handle multi-line refactoring and unit test synthesis:

# Pull the fast autocomplete model (~1.0 GB VRAM/RAM footprint)
ollama pull qwen2.5-coder:1.5b

# Pull the primary chat, edit, and test generation model (~4.7 GB VRAM/RAM footprint)
ollama pull qwen2.5-coder:7b

If your workstation carries a high-end discrete GPU (such as an RTX 4080/4090 or Apple Silicon M-series with 32GB+ unified memory), you can substitute qwen2.5-coder:14b or qwen2.5-coder:32b for the chat role. For standard 16GB developer laptops, 365Finds considers the 1.5b + 7b combination the mandatory efficiency baseline.

Verify both weights are present locally:

ollama list

Step 2: Install and Configure the Continue Extension in VS Code

  1. In VS Code, open the Extensions marketplace (Ctrl+Shift+X or Cmd+Shift+X).
  2. Search for Continue (by Continue Dev) and click Install.
  3. Open the Continue side panel from the activity bar, click the Gear (Settings) icon at the bottom right, and select your configuration file. Continue supports both YAML (~/.continue/config.yaml) and legacy JSON (~/.continue/config.json).

Paste the following dual-role configuration into ~/.continue/config.yaml:

name: Local Tongyi Qianwen Qwen2.5-Coder Setup
version: 1.0.0
schema: v1

models:
  - name: Qwen2.5-Coder 7B
    provider: ollama
    model: qwen2.5-coder:7b
    apiBase: http://localhost:11434
    roles:
      - chat
      - edit
      - apply

tabAutocompleteModel:
  name: Qwen2.5-Coder 1.5B Autocomplete
  provider: ollama
  model: qwen2.5-coder:1.5b
  apiBase: http://localhost:11434

Save the file. Click the gear icon again and choose Reload Config (or restart VS Code).


Step 3: Enforcing and Verifying Offline Operation

To verify that your development pipeline is strictly air-gapped and sending zero telemetry outside your machine:

  1. Disconnect your machine from Wi-Fi or unplug your ethernet cable.
  2. In your terminal, check that Ollama listens strictly on your local loopback:
curl http://127.0.0.1:11434/api/tags

This returns JSON listing your installed models without requiring external network routes. Continue communicates exclusively with http://localhost:11434, keeping proprietary source files, function signatures, and context windows confined to local memory.


Step 4: Generating Unit Tests with Qwen2.5-Coder

Test generation exposes the biggest gap between weak small models and specialized coding models. Qwen2.5-Coder 7B understands test frameworks across Python (pytest, unittest), JavaScript/TypeScript (jest, vitest), Go, and Java (JUnit 5).

Workflow for Full Test Suites:

  1. Open the file containing the functions or classes to test (e.g., auth_service.py).
  2. Highlight the target code block.
  3. Press Ctrl+L (or Cmd+L) to pipe the selection into the Continue Chat window.
  4. Use a structured prompt that forces edge-case coverage rather than trivial sanity checks:
Write a complete pytest test suite for the highlighted function. 
Include:
1. Happy path cases with expected outputs.
2. Edge cases (empty inputs, boundaries, type mismatches).
3. Explicit exception handling assertions using pytest.raises.
Do not use mock objects unless network or database calls are present.
  1. Qwen2.5-Coder streams the test code directly in the sidebar. Click Insert at Cursor or Apply to File to write the test file.

Workflow for Quick Inline Assertions:

  1. Place your cursor right below an untested function.
  2. Press Ctrl+I (or Cmd+I) to open Continue's inline diff interface.
  3. Type: Generate 3 unit test cases covering edge cases for this function.
  4. Accept the suggested diff with Ctrl+Shift+Enter (or Cmd+Shift+Enter).

Step 5: Inline Autocomplete Behavior and Latency Tuning

Open an active code file and type a standard function signature:

// Calculate exponential backoff delay with jitter
export function calculateBackoff(attempt: number, baseDelayMs: number): number {

Pause for half a second. The qwen2.5-coder:1.5b model will render inline ghost suggestions in gray text. Press Tab to accept.

If autocomplete feels sluggish on machines without dedicated GPU acceleration:


365Finds Assessment: Where This Setup Wins and Where It Breaks

At 365Finds, we admire Tongyi Qianwen's decision to train Qwen2.5-Coder with up to 128K context support and genuine repository awareness. On everyday algorithmic functions and standard CRUD unit tests, the 7B model produces cleaner pytest and Vitest suites than many general-purpose 70B models. It rarely hallucinates non-existent library methods if prompted with exact signatures.

However, developers must recognize the architectural trade-offs:

DimensionQwen2.5-Coder Local (1.5B + 7B)Cloud Assistants (Copilot / Claude 3.5)
Data Privacy100% offline, zero data exfiltrationRelies on remote server policies and internet access
Subscription Cost$0 recurring$10–$20/user/month
Autocomplete Latency80–180 ms on discrete GPU; ~300 ms on CPU150–350 ms depending on network round-trip
Large-Repo ReasoningModerate (limited by workstation VRAM and local context caching)High (global cloud indexing and frontier reasoning models)
Setup FrictionRequires Ollama, weight downloads, and manual configSingle-click sign-in

365Finds strongly recommends this configuration for enterprise teams handling classified IP, air-gapped defense projects, and developers seeking complete independence from subscription APIs. If your machine has at least 16GB of system RAM, Qwen2.5-Coder paired with Continue delivers a private coding environment that genuinely rivals commercial cloud plugins.

References