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:
- Use an AI coding extension that supports inline suggestions
- 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
- Open VS Code
- Go to Extensions (
Ctrl+Shift+X/Cmd+Shift+X) - Install:
- GitHub Copilot
- optionally GitHub Copilot Chat
- Sign in to GitHub and enable the extension
- Open a test file, such as:
*.test.js*.spec.tstest_*.py
- 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:
- Install the extension from the Extensions marketplace
- Sign in or connect the service
- Open the source file
- 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