Prompt

How do I set up an inline code suggester for test code generation inside VS Code?

Latest observation

Jul 19, 2026 · OpenAI APIWeb search: off

To set up an inline code suggester for test code generation in VS Code, you generally have two good options:

  1. Use an AI coding extension that supports inline suggestions
  2. Build your own inline completion provider if you want a custom workflow

Option 1: Use an extension like GitHub Copilot

This is the easiest setup.

Steps

  1. Open VS Code
  2. Go to Extensions (Ctrl+Shift+X / Cmd+Shift+X)
  3. Install:
    • GitHub Copilot
    • optionally GitHub Copilot Chat
  4. Sign in to GitHub and enable the extension
  5. Open a test file, such as:
    • *.test.js
    • *.spec.ts
    • test_*.py
  6. Start typing a test scaffold, and Copilot will suggest inline completions

Helpful settings

You can make sure inline suggestions are enabled:

{
  "editor.inlineSuggest.enabled": true
}

You can also ensure suggestions appear automatically:

{
  "editor.suggestOnTriggerCharacters": true,
  "editor.quickSuggestions": true
}

Option 2: Use an extension focused on test generation

Some extensions generate tests from existing code and may also offer inline suggestions or commands.

Examples:

  • Qodo (CodiumAI)
  • TestPilot-like test generation tools
  • Codeium
  • Tabnine

Typical setup:

  1. Install the extension from the Extensions marketplace
  2. Sign in or connect the service
  3. Open the source file
  4. Run the “Generate Tests” command or use inline completion if supported

Option 3: Build your own inline suggester

If you want custom inline suggestions specifically for test generation, you can create a VS Code extension using the Inline Completion API.

Basic idea

Your extension:

  • watches the current file
  • detects when the user is in a test file or requesting tests
  • returns an inline completion suggestion

Example extension API

Use registerInlineCompletionItemProvider in your extension:

import * as vscode from 'vscode';

export function activate(context: vscode.ExtensionContext) {
  context.subscriptions.push(
    vscode.languages.registerInlineCompletionItemProvider(
      { pattern: '**/*.{test,spec}.{js,ts,py}' },
      {
        provideInlineCompletionItems(document, position) {
          const text = document.getText();

          // Example: suggest a test skeleton
          if (text.includes('function add')) {
            return [
              new vscode.InlineCompletionItem(
                'test("adds numbers correctly", () => {\n  expect(add(1, 2)).toBe(3);\n});',
                new vscode.Range(position, position)
              )
            ];
          }

          return [];
        }
      }
    )
  );
}

Enable inline suggestions in VS Code

Add this to your settings:

{
  "editor.inlineSuggest.enabled": true
}

Recommended setup for most people

If your goal is just to generate tests quickly inside VS Code, the best path is:

  • Install GitHub Copilot
  • Turn on editor.inlineSuggest.enabled
  • Use test file naming conventions like .test.ts, .spec.ts, etc.

If you want, I can also give you:

  • a step-by-step Copilot setup
  • a custom VS Code extension template for test inline suggestions
  • settings specifically for JavaScript, TypeScript, Python, or Java

Observation history

Unlock observation history

Create a free Obsurfable account to unlock historical responses, model comparisons, and deeper brand intelligence.

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (1 observation for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, and Meta AI.