SOP-004: Tab Autocomplete
Document Control
| Field | Value |
|---|---|
| SOP ID | SOP-004 |
| Version | 1.0 |
| Status | Active |
| Last Updated | 2024-12 |
Purpose
This SOP covers mastering Cursor's Tab autocomplete feature, including multi-line completions, cross-file navigation, and auto-imports.
Scope
- Understanding Tab suggestions
- Accepting and rejecting completions
- File jumps and auto-imports
- Configuration options
Prerequisites
- Cursor installed and configured
- Tab enabled in Cursor Settings
Procedure
How Tab Works
Flow: You Type → AI Predicts → Ghost Text → Accept/Reject
| Step | What Happens |
|---|---|
| You Type | Code + intent |
| AI Predicts | Context + recent edits analyzed |
| Ghost Text | Semi-opaque suggestion appears |
| Accept/Reject | Tab = Accept, Esc = Reject |
Context Considered:
- Current file content
- Recent changes
- Linter errors
- Previously accepted edits
Step 1: Basic Usage
Trigger Suggestions: Simply start typing. Tab suggestions appear automatically as ghost text.
Accept/Reject:
| Action | Shortcut |
|---|---|
| Accept full suggestion | Tab |
| Reject suggestion | Escape |
| Accept word-by-word | Cmd+→ / Ctrl+→ |
| Keep typing | Suggestion updates |
Example:
// Type: function calc
// Ghost text appears: ulateSum(a, b) { return a + b; }
// Press Tab to accept
function calculateSum(a, b) { return a + b; }Step 2: Multi-Line Completions
Tab can suggest entire blocks of code:
You type:
if (user.Tab suggests:
javascriptif (user.isAuthenticated) { return { success: true }; } else { return { success: false, error: 'Unauthorized' }; }Press
Tabto accept all lines
Step 3: Partial Accepts
Enable in Cursor Settings > Tab > Partial Accepts
Use Cmd+→ / Ctrl+→ to accept one word at a time:
// Suggestion: console.log('User authenticated successfully');
// Press Cmd+→ once: console.
// Press Cmd+→ again: console.log(
// Continue until satisfiedWhen to Use Partial Accepts
- When suggestion is mostly right but needs tweaking
- When you want to verify each part
- When learning what Tab suggests
Step 4: Jump in File
After accepting a Tab suggestion, Tab can jump you to the next edit location:
function greet(name) { // ← Accept Tab here
return `Hello, ${name}`;
}
// Press Tab again...
function farewell(name) { // ← Jumps here automatically
return `Goodbye, ${name}`;
}Tab predicts where you'll need to edit next and jumps there.
Step 5: Jump Across Files
Tab predicts edits needed in related files:
- You edit:
api/users.ts- add new functiongetUser() - Portal appears: at bottom of screen
- Shows suggestion:
types/user.ts- Add type definition - Press Tab: to jump to
types/user.tsand apply the edit
This works great for:
- Adding type definitions when creating new functions
- Updating imports when adding exports
- Synchronizing related code across files
Step 6: Auto-Import
Tab automatically adds missing imports (TypeScript & Python):
// You type: const response = axios.get(
// Tab auto-adds at top of file:
import axios from 'axios';
// Then completes your code:
const response = axios.get('/api/users');Troubleshooting Auto-Import:
- Ensure language server is active
- Check if import shows in Quick Fix (
Cmd+./Ctrl+.) - Verify TypeScript/Python extensions installed
Step 7: Tab in Peek
Use Tab inside Go to Definition peek views:
- Right-click a function → Go to Definition (or press F12)
- Peek view opens inline
- Tab works inside the peek view
- Great for updating function signatures and fixing call sites
Vim Users
Use gd to jump to definitions, modify with Tab, then return.
Configuration
Navigate to Cursor Settings > Tab:
| Setting | Description | Default |
|---|---|---|
| Cursor Tab | Enable/disable AI completions | On |
| Partial Accepts | Word-by-word acceptance | Off |
| Suggestions While Commenting | Tab in comment blocks | On |
| Whitespace-Only | Format-only suggestions | Off |
| Auto Import (TS) | TypeScript auto-imports | On |
| Auto Import (Python) | Python auto-imports | Beta |
Toggling Tab
Use status bar (bottom-right) to:
- Snooze: Temporarily disable
- Disable globally: Turn off for all files
- Disable for extensions: Turn off for specific file types (e.g.,
.md,.json)
Best Practices
DO:
- Write descriptive variable/function names
- Add comments for complex logic (Tab reads them)
- Use partial accepts for verification
- Let Tab complete boilerplate
DON'T:
- Accept suggestions without reading them
- Fight Tab - if rejecting often, adjust approach
- Rely on Tab for security-critical code
Verification Checklist
- [ ] Tab suggestions appear when typing
- [ ] Escape properly rejects suggestions
- [ ] Partial accepts work with Cmd+→
- [ ] Jump in file works after accepting
- [ ] Cross-file jump portal appears when relevant
- [ ] Auto-imports added for TypeScript/Python
Troubleshooting
| Issue | Solution |
|---|---|
| No suggestions appearing | Check Tab is enabled in settings |
| Wrong/irrelevant suggestions | Add more context (comments, variable names) |
| Auto-import not working | Check language server active, test with Cmd+. |
| Tab interfering with typing | Snooze temporarily or disable for file type |
| Slow suggestions | Check network, disable heavy extensions |