Triggering Inline Completions: Tab, Hover, Next/Prev
Use ghost-text completions fluidly — accept, reject, cycle alternatives.
What You Will Learn
- Trigger completions by typing and pausing.
- Accept with Tab, reject with Esc.
- Cycle alternatives with Alt+[ and Alt+].
- Use partial acceptance (accept word by word).
- Force-trigger when no suggestion appears.
Why This Matters
Inline completions are the most-used Copilot surface. Knowing the keyboard shortcuts fluidly turns Copilot from a curiosity into a tool you reach for every minute.
Concept Explained
Inline completions appear as gray ghost text after you pause typing. The model watches your cursor and the surrounding lines, predicts what comes next, and renders the prediction inline. You accept, reject, or cycle alternatives.
How It Works
VS Code listens to text-changed events, debounces for the configured delay (~400ms default), sends context to the Copilot service, and renders the returned tokens as ghost text. Pressing Tab merges the ghost text into your buffer. Cycling asks the service for alternative completions.
Step-by-Step Tutorial
1. Trigger a completion
Open a .ts/.py/.js file. Type `function add(a, b) {` and pause. Gray text appears proposing a body.2. Accept with Tab
Press Tab to accept the whole suggestion. Use Ctrl+Right (Cmd+Right) to accept word-by-word.3. Reject with Esc
Press Esc to dismiss. The suggestion won't reappear until you type more.4. Cycle alternatives
Press Alt+] (Option+] on Mac) for next alternative, Alt+[ for previous.5. Force-trigger
Press Alt+\ (Option+\) to manually request a completion when none appeared.Real-World Example
A backend dev writing a TypeScript Express handler typed the function signature and paused. Copilot proposed a complete handler with error handling, validation, and a typed response. The dev accepted the body, modified the validation rules to match their schema, and shipped in 90 seconds. Without Copilot, the same handler would have taken 5 minutes.
Example Prompts / Commands / Code
// Type this signature and pause:
function parseDate(input: string): Date | null {
// Copilot proposes:
// const d = new Date(input);
// return isNaN(d.getTime()) ? null : d;
}
Tab accept full suggestion
Ctrl+Right accept one word
Esc dismiss
Alt+] (Opt+]) next alternative
Alt+[ (Opt+[) previous alternative
Alt+\ (Opt+\) force trigger
Common Mistakes
- Tab-Tab-Tab without reading — biggest source of Copilot bugs.
- Forgetting Esc exists — dismissing bad suggestions is as important as accepting good ones.
- Never cycling alternatives — the first suggestion isn't always best.
- Forcing triggers constantly — uses more credits, rarely helps.
Best Practices
- Read every suggestion before accepting.
- Cycle alternatives when the first suggestion feels off.
- Accept word-by-word for long suggestions to keep control.
- Adjust the delay in settings to match your typing speed.
Troubleshooting
| Problem | How to Fix |
|---|---|
| No ghost text appears | Check the status icon is healthy. Verify the language is supported. Try force-trigger (Alt+\). |
| Tab doesn't accept | Check keybindings for conflicts. Search 'Accept Copilot Suggestion' in Keyboard Shortcuts. |
| Suggestions feel slow | Increase the debounce delay (counterintuitively, faster requests feel slower when rate-limited). Try a smaller model. |
Practical Exercise
Your Turn
Write a function `isPalindrome(s: string): boolean` using only Copilot suggestions. Try the cycle alternatives at least twice.
Key Takeaways
- Tab accepts, Esc dismisses, Alt+[/] cycles.
- Read before accepting — always.
- Word-by-word acceptance keeps control on long suggestions.
- Force-trigger when no suggestion appears.
- Adjust debounce to match your typing rhythm.
Frequently Asked Questions
Can I disable inline completions temporarily?
Why are suggestions sometimes way off?
Does cycling cost more credits?
Further Reading
Official References
SEO Metadata
SEO title: Triggering Inline Completions: Tab, Hover, Next/Prev
Meta description: Use ghost-text completions fluidly — accept, reject, cycle alternatives.
Primary keyword: triggering inline completions
Secondary keywords: triggering inline completions: tab, hover, next/prev
Search intent: Informational
URL slug: /triggering-github-copilot-inline-completions
Categories: AI Tools, GitHub Copilot
Tags: GitHub Copilot, Beginner, Inline Completions, IMCSEIAN, Tutorial, IMCSEIAN
Featured image concept: IMCSEIAN lesson card for Triggering Inline Completions: Tab, Hover, Next/Prev
Comments
Comments
Post a Comment