Tab Completion & Predictions

30 min beginner Lesson 3

Learning Outcomes

  • Understand how Cursor's autocomplete differs from standard editor completions
  • Accept multi-line tab completions confidently
  • Recognise ghost text predictions and decide when to use them
  • Know when to accept AI suggestions vs type manually
  • Configure completion behaviour for your preferred workflow

Lesson Plan

Segment Duration Topic
Intro 3 min What autocomplete looks like in Cursor
Demo 1 7 min Typing code and observing ghost text
Explain 4 min How Cursor Prediction differs from traditional autocomplete
Demo 2 6 min Multi-line completions — accepting and navigating
Explain 4 min When to accept vs when to type
Demo 3 3 min Configuring completion settings
Wrap-up 3 min Key takeaways and next lesson preview

Before You Begin

Pre-work:

Shopping List:

  • Cursor open with a code file
  • Tab completion enabled in settings
  • A file you're actively writing code in (the more context, the better predictions)

1 How Cursor's Autocomplete Differs

Traditional autocomplete (IntelliSense in VS Code) suggests variable names, function names, and language keywords based on static analysis. Cursor's tab completion is fundamentally different:

Traditional autocomplete:

  • Suggests known symbols (variables, methods, imports)
  • Based on language server analysis
  • Typically completes a single token or identifier
  • Deterministic — same context always gives same suggestions

Cursor Tab (AI autocomplete):

  • Predicts what you'll type next based on context and intent
  • Uses an AI model trained on code patterns
  • Can suggest entire lines or multi-line blocks
  • Understands natural patterns, not just syntax
  • Adapts to your coding style and the current file's patterns

What this looks like in practice:

When you type function validate in a file that already has other validation functions, Cursor might predict the entire function body — not just the function name, but the parameters, the logic, and the closing brace.

The prediction appears as ghost text — grey, semi-transparent text ahead of your cursor. Press Tab to accept, or keep typing to ignore it.

NOTE
How It Works
Cursor Tab uses a lightweight, fast model specifically optimised for code completion. It's different from the frontier model that powers Chat. It's designed for speed — predictions appear within 100-300ms of you pausing.

Cursor Tab is not GitHub Copilot:

While both show ghost text completions, Cursor Tab:

  • Uses your full file context more effectively
  • Predicts based on recent edits (not just the cursor position)
  • Can suggest edits to existing code (not just insertions)
  • Works alongside Chat and Inline Edit as part of an integrated system

2 Tab to Accept Multi-Line Completions

Cursor's most powerful completion feature is multi-line prediction. Instead of completing one word, it can predict entire blocks.

How multi-line completions appear:

  1. You type the beginning of a pattern (e.g., a function signature)
  2. Ghost text appears showing multiple predicted lines
  3. All ghost text is grey/dimmed to distinguish from your code
  4. The completion may span 2-20+ lines

Accepting completions:

Action Key Result
Accept entire suggestion Tab All ghost text is inserted
Accept one word Ctrl+Right Arrow Just the next word is accepted
Accept one line Cmd+Right Arrow (Mac) / End then Tab Just the current line
Reject suggestion Escape or keep typing Ghost text disappears
See alternative Wait or trigger manually May show different prediction

Example scenario — writing a test:

You have a function calculateTotal(items) in your project. In a test file, you type:

test('calculateTotal

Cursor predicts:

test('calculateTotal returns sum of item prices', () => {
  const items = [
    { name: 'Widget', price: 9.99 },
    { name: 'Gadget', price: 14.99 },
  ];
  expect(calculateTotal(items)).toBe(24.98);
});

Press Tab and the entire test is written for you.

When multi-line completions work best:

  • Writing tests for existing code
  • Implementing functions that follow established patterns
  • Creating data structures similar to existing ones
  • Writing repetitive code (routes, handlers, config)
  • Filling in boilerplate (imports, exports, class methods)
TIP
Tip
Write a good comment or function name first. Cursor uses these as signals for what to predict. A clear function signature like function validateEmail(email: string): boolean gives the model a strong hint about what the body should contain.
WARNING
Watch Out
Multi-line completions can occasionally be wrong, especially for complex business logic. Always read the ghost text before pressing Tab. Speed is good, but correctness matters more.

3 Ghost Text Predictions — How They Work

Ghost text is the grey preview text that appears as you type. Understanding how it's generated helps you work with it more effectively.

What triggers ghost text:

  1. Pausing while typing — after ~300ms of inactivity, Cursor predicts your next move
  2. Completing a statement — after a semicolon, closing brace, or newline
  3. Starting a new line — especially after patterns like if, for, function
  4. Context changes — when you switch to a new logical section of code

What the model considers:

  • The current file's content (above and below the cursor)
  • Your recent edits in this session
  • Other open files in the workspace
  • The programming language and framework conventions
  • File names and directory structure (hints about purpose)

Ghost text states:

What You See What It Means
Grey text appears Prediction ready — Tab to accept
No ghost text Model hasn't predicted yet (keep typing)
Ghost text changes You typed something that shifted the prediction
Ghost text disappears You typed something that diverged from the prediction

The prediction adapts in real-time:

As you type each character, the prediction updates. If the ghost text shows console.log(result) and you type c-o-n-s, the prediction confirms and you can Tab to accept the rest. If you type r-e-t-u-r-n, the prediction shifts to match your intent.

Partial acceptance:

You don't have to accept the full prediction. Common patterns:

  1. Ghost text shows an entire if block
  2. You only want the condition, not the body
  3. Accept word-by-word using Ctrl+Right Arrow until you reach where you want to diverge
  4. Then type your own code — the ghost text updates
NOTE
How It Works
The completion model runs locally-assisted inference. It sends context to a fast model and caches results. This is why predictions feel nearly instant — much of the work is pre-computed as you type.

4 Training Your Completion Model with Usage

Cursor's completions improve as it observes your coding patterns within a session and across your project.

How your behaviour shapes predictions:

  • Accepting completions for a pattern reinforces that pattern for future suggestions
  • Rejecting completions (typing over them) signals that the model's prediction style doesn't match your intent
  • Your recent edits are weighted heavily — if you just wrote three similar functions, the fourth prediction will match the style
  • File patterns matter — if every function in the file uses arrow syntax, predictions will follow suit

Techniques to get better predictions:

  1. Be consistent in your style — the model picks up on your patterns. If you use const everywhere, predictions will use const.

  2. Write clear function signatures first — type the full signature before pausing for the body prediction:

    // Good: gives the model clear intent
    function parseUserInput(raw: string): ParsedInput {
    
    // Less effective: ambiguous
    function parse(x) {
  3. Use descriptive variable names — userEmailList predicts more accurately than data

  4. Establish patterns early in the file — the first few functions set the template for predictions in the rest of the file

  5. Keep related code in the same file — more local context means better predictions

What NOT to expect:

  • Predictions won't understand complex business requirements from comments alone
  • Very novel logic (no similar pattern in the file) gets less accurate predictions
  • Long functions with branching logic may get incorrect continuations
  • The model doesn't read your mind — it reads patterns
TIP
Tip
If you're starting a new file and want good predictions from the start, write 2-3 complete functions manually. Once the model sees your pattern, subsequent predictions will match your style.

5 When to Accept vs When to Type Manually

Not every ghost text prediction should be accepted. Developing judgment about when to use Tab vs when to type is a key skill.

Accept the prediction when:

  • It matches exactly what you intended to write
  • It's boilerplate or repetitive code you'd have written the same way
  • It's a standard pattern (error handling, imports, common algorithms)
  • The variable names and logic align with your design
  • It's a test that correctly matches your implementation

Type manually when:

  • The prediction uses wrong variable names
  • The logic is subtly incorrect (wrong condition, off-by-one)
  • You want to write something novel that the model can't predict
  • The prediction is too long/complex and you'd spend more time reading it than writing
  • You're in a section requiring careful thought (security, financial calculations)

The "skim then decide" habit:

Build this habit:

  1. Ghost text appears
  2. Skim it in 1-2 seconds
  3. If it looks right → Tab
  4. If it looks wrong → keep typing
  5. If it's partially right → accept word-by-word, then diverge

Speed comparison:

Scenario Typing Speed Tab Accept Speed Winner
Simple boilerplate (imports) 5 sec 0.5 sec Tab
Complex logic 30 sec 15 sec reading + risk Typing
Repetitive patterns (tests) 20 sec 1 sec Tab
Novel algorithm N/A Wrong prediction Typing
WARNING
Watch Out
Don't fall into 'Tab blindness' — accepting every prediction without reading it. This introduces subtle bugs that are hard to catch later. Every Tab press should be a conscious decision.
TIP
Tip
If you're learning a new language or framework, type more manually at first. This helps you learn the syntax rather than relying on the AI to write it for you. Use Tab for the parts you already understand.

6 Configuring Completion Behaviour

You can tune Cursor's tab completion to match your preferred workflow.

Open Cursor Settings (Cursor Settings (gear icon)) → Features → Cursor Tab

Open Cursor Settings (Ctrl+Shift+J) → Features → Cursor Tab

Available settings:

Setting Options Recommended
Enable Cursor Tab On / Off On
Suggestion style Ghost text / Inline Ghost text
Trigger delay 100ms - 1000ms 300ms (default)
Max lines 1 - 50 10-20 lines
Languages Enable/disable per language All enabled

Per-language configuration:

If you find completions less useful for certain languages (e.g., they're great for TypeScript but distracting for Markdown), you can disable Tab completion per language:

  1. Open Cursor Settings
  2. Navigate to Features → Cursor Tab
  3. Look for language-specific toggles
  4. Disable for languages where predictions are unhelpful

Adjusting the trigger delay:

  • Shorter (100-200ms): Predictions appear faster, may feel intrusive
  • Default (300ms): Good balance of speed and non-intrusiveness
  • Longer (500ms+): Only see predictions when you genuinely pause

If you find ghost text distracting while you're thinking, increase the delay. If you want maximum speed, decrease it.

Disabling temporarily:

Sometimes you want to type without predictions (e.g., writing documentation or novel logic). You can:

  • Toggle off in settings (persistent)
  • Or simply ignore ghost text — it doesn't interfere if you keep typing
NOTE
How It Works
Settings changes take effect immediately. You don't need to restart Cursor. Try adjusting the delay while coding to find your sweet spot.
TIP
Tip
Start with defaults for a week. Track when you accept vs reject predictions. If your accept rate is below 30%, consider adjusting the delay or max lines setting.

Questions & Answers

Q: Does Cursor Tab use the same model as Chat?
No. Tab completion uses a specialised, smaller model optimised for speed. It needs to respond in under 300ms, so it cannot use a full frontier reasoning model. Think of it as a fast prediction engine, while Chat uses the full reasoning model.
Q: Do tab completions count against my usage quota?
Tab completions are included in your Cursor Pro subscription with generous limits. They're tracked separately from Chat/Cmd+K requests. On the free tier, you get a limited number of completions per day.
Q: Can I see multiple alternative completions?
Currently, Cursor shows one prediction at a time. If you reject it (by typing), the next prediction will be different based on what you typed. Unlike traditional autocomplete, there isn't a dropdown of alternatives — the model gives its best single prediction.
Q: Why are predictions sometimes wrong or irrelevant?
The model can only work with available context. Predictions may be off when: you're writing novel logic with no similar patterns in the file, the code depends on external systems the model doesn't know about, or when you're at the start of an empty file with little context. The more you write, the better predictions become.

Key Takeaways

  1. Cursor Tab is AI-powered — it predicts intent, not just symbols. It's smarter than traditional autocomplete.
  2. Tab accepts, Escape rejects — you're always in control of what gets inserted
  3. Multi-line completions are the biggest productivity win — entire functions, tests, and patterns in one keystroke
  4. Read before you Tab — develop the habit of skimming ghost text before accepting
  5. Context drives quality — clear names, consistent patterns, and descriptive signatures improve predictions
  6. Configure to taste — adjust delay, max lines, and per-language settings to match your workflow

Next Steps: In Lesson 4 — Multi-File Context, you'll learn how to give Cursor's AI visibility across your entire project using @-mentions and codebase indexing.