Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Tab AheadNew to Visual Studio Code? Get it now.
Tab Ahead

Tab Ahead

Rivaan Ranawat

|
1 install
| (0) | Free
AI Tab Completion for VS Code
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Tab Completion

An AI-powered VS Code extension that provides inline code completions with replacement support. Unlike simple insert-at-cursor completions, Tab Completion can replace existing code (fixing typos, completing partial expressions, rewriting statements) using context from the current file, cross-file symbols, and recent edit history.

How It Works

  1. As you type, the extension gathers context: prefix code, the replacement region (text from cursor to statement end), suffix, cross-file type signatures, and your recent edit history.
  2. This context is sent to an LLM (via OpenRouter, Groq, or Fireworks) as a structured prompt with a token budget.
  3. The model's response is deduplicated, diffed against existing code, and shown as ghost text. Text that would be deleted is highlighted with a red strikethrough.
  4. Press Tab to accept or Escape to reject.

Features

  • AI-Powered Completions — Streaming LLM responses via OpenRouter, Groq, or Fireworks with automatic provider selection.
  • Replacement-Style Edits — Completions can replace existing code, not just insert. A minimal diff is computed so only the changed portion is touched.
  • Tree-Sitter AST Analysis — WASM-based parsing for 9 languages (TypeScript, TSX, JavaScript, Python, Rust, Go, Java, C, C++) to find statement boundaries and extract signatures.
  • Cross-File Context — Indexes workspace symbols via LSP, resolves import aliases, and includes type signatures of referenced external symbols in the prompt.
  • Smart Prefix Construction — For large files, builds a scoped prefix with only relevant imports, local dependencies, class headers, and function body instead of sending the entire file.
  • Edit History Tracking — Monitors your edits in real-time (adds, edits, pastes, accepted/rejected suggestions) and includes the last 35 entries in the prompt so the model understands your intent.
  • Deduplication — Three-strategy dedup (lookbehind overlap, structural overlap via Levenshtein similarity, trailing overlap) prevents suggesting code that already exists.
  • Completion Caching — Results are cached by content hash + cursor position + edit history, so repeated triggers at the same spot are instant.
  • Deletion Decoration — Red strikethrough highlighting on code that will be removed when you accept a replacement completion.
  • Continuation Prediction — If you start typing characters that match the last completion, the remaining portion is re-shown without a new API call.
  • Multi-Language Import Parsing — Detects and filters imports for JS/TS, Python, Rust, Go, Java, and C/C++ so only used imports appear in context.
  • Token Budget Management — A 15k-token budget is allocated across prompt sections to prevent exceeding model limits.

Supported Languages

TypeScript, TSX, JavaScript, Python, Rust, Go, Java, C, C++

Extension Settings

Setting Default Description
tabahead.openrouterApiKey "" OpenRouter API key
tabahead.groqApiKey "" Groq API key
tabahead.fireworksApiKey "" Fireworks AI API key
tabahead.model "qwen/qwen3-32b" AI model to use for completions
tabahead.maxTokens 500 Maximum tokens to generate (50–5000)
tabahead.completionCacheMaxEntries 100 Max entries in completion cache (10–1000)
tabahead.completionCacheTtlMs 30000 Completion cache TTL in ms (5000–120000)
tabahead.lspCacheMaxEntries 100 Max entries in LSP cache (10–1000)

Getting Started

  1. Clone the repository and install dependencies:
    npm install
    
  2. Open the project in VS Code and press F5 to launch the Extension Development Host.
  3. Set at least one API key in VS Code settings (e.g., tabahead.openrouterApiKey).
  4. Start typing in any supported language file — completions will appear as ghost text.

Keybindings

Key Action
Tab Accept the current completion (falls back to normal Tab if no completion is pending)
Escape Reject the current completion

Architecture

src/
├── extension.ts                  # Entry point: activation, command registration
├── api/
│   └── apiClient.ts              # Streaming LLM API client (OpenRouter/Groq/Fireworks)
├── cache/
│   ├── boundedCache.ts           # Generic bounded cache with TTL & eviction
│   └── completionCache.ts        # Completion-specific cache (content hash keyed)
├── providers/
│   └── inlineCompletionProvider.ts  # VS Code InlineCompletionItemProvider
├── services/
│   ├── astAnalysis.ts            # AST analysis: statement ends, signatures, declarations
│   ├── astService.ts             # Tree-sitter parser initialization & language loading
│   ├── configurationService.ts   # Singleton config with change listeners
│   ├── contextGatherer.ts        # Orchestrates context stages into CompletionContext
│   ├── deduplicationService.ts   # Three-strategy completion deduplication
│   ├── intentTracker.ts          # Real-time edit history tracking
│   ├── lspService.ts             # Cached LSP queries (symbols, type hierarchy)
│   ├── promptBuilder.ts          # Prompt construction with token budgeting
│   ├── contextStages/
│   │   ├── prefixStage.ts        # Smart prefix with scope-aware truncation
│   │   ├── suffixStage.ts        # Structural suffix extraction
│   │   ├── replacementRegionStage.ts  # AST-based replacement region computation
│   │   └── localDependencyResolver.ts # Same-file dependency resolution
│   └── crossFile/
│       ├── crossFileService.ts   # Cross-file symbol orchestration
│       ├── referenceExtractor.ts # Identifier reference extraction from prefix
│       ├── signatureProvider.ts  # AST-based signature extraction with caching
│       └── symbolIndex.ts        # Workspace symbol indexing
├── ui/
│   └── deletionDecoration.ts     # Strikethrough decoration for deletions
└── utils/
    ├── types.ts                  # Shared TypeScript interfaces
    ├── importAnalysis.ts         # Multi-language import detection & parsing
    └── languageUtils.ts          # Keywords, identifiers, Levenshtein, normalization

Development

npm run compile    # Build TypeScript
npm run watch      # Watch mode
npm run lint       # Run ESLint
npm run test       # Run tests
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft