Skip to content
LikhinMNPublic

About

Lightweight, ultra-fast inline code completion extension powered by Ollama and Codegemma.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Tau logo

Tau

Lightweight, ultra-fast inline code completion extension powered by Ollama and Codegemma.

by @likhin

MIT license Ollama Local VS Code Version TypeScript FIM Supported

Developer: Types function getFibonacci(n: number) { and pauses for 300ms.

Tau: Extracts surrounding code context, formats a Fill-in-the-Middle (FIM) prompt for your local Ollama instance, and streams inline ghost text with zero latency and 100% privacy.

Tau Demo

Quick Start

# 1. Install & start Ollama locally
ollama pull codegemma:2b

# 2. Clone and install Tau dependencies
git clone https://github.com/example/tau.git
cd tau && npm install

# 3. Compile and launch in VS Code / Cursor
npm run compile
# Press F5 in your editor to launch the Extension Development Host!
Table of contents

What Is Tau?

Tau is a modern, ultra-lightweight inline code completion extension designed specifically for developers who demand 100% local execution, zero telemetry, and sub-second latency.

Unlike cloud-dependent Copilots, Tau communicates directly with your local Ollama server using specialized Fill-in-the-Middle (FIM) token insertion. It features intelligent debouncing, instant request cancellation on new keystrokes, and automatic fallback handling for models that do not natively support FIM insertion.

The central completion flow is:

flowchart LR
    A[VS Code / Cursor Editor] -->|Keystroke & Cursor Position| B[Context Extractor]
    B -->|Prefix & Suffix FIM Prompt| C[Local Ollama API]
    C -->|Raw Completion| D[Post-Processor & Deduplication]
    D -->|Ghost Text Suggestion| A
Loading

All AI processing lives on your local machine. No source code ever leaves your hardware.

Who This README Is For

Start with the section that matches your goal:

  • Use Tau: Set up and run inline code completions in your daily workflow.
  • Keyboard Shortcuts & Commands: Master Tab acceptance, Right Arrow word-by-word completion, and status bar controls.
  • Architecture Details: Understand the debouncing, FIM extraction, and auto-fallback retry logic.
  • Configuration: Customize endpoints, token limits, sampling temperatures, and debounce timing.

What Is Included

Component Role
src/inlineCompletionProvider.ts Orchestrates inline suggestions, debouncing, request cancellation, and deduplication.
src/ollamaManager.ts Statically-typed API wrapper communicating with Ollama /api/generate with FIM fallback logic.
src/statusBar.ts Visual status indicator (Ready, Generating, Offline, Disabled, Error) with quick pick menu.
src/extension.ts Extension lifecycle management and VS Code command registration.
example.ts Interactive sample TypeScript file with pre-built scenarios for testing completions.

Prerequisites

  • Ollama running locally (default endpoint: http://localhost:11434).
  • A compatible code completion model such as codegemma:2b, codegemma:7b-code, or qwen2.5-coder.
  • VS Code or Cursor version ^1.85.0.
  • Node.js (>=18.x) and npm for building from source.

Use Tau

Launching in VS Code or Cursor

  1. Open the repository in your editor:
    code .
  2. Run the compiler:
    npm run compile
  3. Press F5 (or open the Debug panel and click Run Extension).
  4. In the newly launched Extension Development Host window, open example.ts and try placing your cursor inside empty functions!

Keyboard Shortcuts & Commands

Tau is built for intuitive, frictionless coding. We configure standard inline completion shortcuts out of the box:

Keybindings

Shortcut Command Action
Tab editor.action.inlineSuggest.commit Accept the entire inline suggestion.
→ (Right Arrow) editor.action.inlineSuggest.acceptNextWord Accept the next word of the suggestion.
Ctrl + → / Cmd + → editor.action.inlineSuggest.acceptNextWord Accept the next word of the suggestion.
Esc editor.action.inlineSuggest.hide Dismiss the current inline suggestion.

Note on Right Arrow: By default in VS Code, Right Arrow moves the cursor away and cancels ghost text. Tau automatically contributes custom keybindings so pressing Right Arrow commits word-by-word, matching modern AI assistant workflows.

Command Palette & Status Bar

Click the status bar item ($(check) Tau: codegemma:2b in the bottom-right corner) or use Ctrl+Shift+P (Cmd+Shift+P) to access:

  • Tau: Toggle Inline Completion (tau.toggle): Enable or disable suggestions instantly.
  • Tau: Change Ollama Model (tau.changeModel): Switch models dynamically via a quick-pick menu of your local Ollama library.
  • Tau: Open Settings (tau.openSettings): Jump directly to Tau's VS Code configuration settings.
  • Re-check Ollama Connection: Verify API server reachability.

Architecture Details

1. Fill-in-the-Middle (FIM) & Auto-Fallback

Tau extracts up to 100 lines of prefix before your cursor and 50 lines of suffix after your cursor. It wraps these in standardized FIM stop tokens (<|fim_prefix|>, <|fim_suffix|>, <|fim_middle|>).

If an instruction-tuned model is selected (e.g., codegemma:7b-instruct or llama3) that rejects FIM insertion with an HTTP 400 Bad Request (does not support insert), Tau catches the error silently, strips the suffix parameter, and re-attempts the request as standard code completion without crashing.

2. Debouncing & Abort Controllers

To prevent overloading your GPU while typing rapidly, Tau implements a configurable debounce timer (default 300ms). Every new keystroke cancels any pending timeout and aborts in-flight HTTP requests via standard AbortController signals.

3. Smart Deduplication

Generated completions are automatically post-processed to:

  • Strip markdown code fences (e.g., typescript ... ).
  • Detect and truncate multiline overlap where generated text duplicates lines already present in the suffix below your cursor.

Configuration

Customize Tau in your user settings.json or by searching for Tau in the VS Code Settings UI:

Setting Type Default Description
tau.enabled boolean true Enable or disable Tau inline code completion.
tau.endpoint string "http://localhost:11434" Local Ollama API server endpoint URL.
tau.model string "codegemma:2b" Ollama model tag to use for completion.
tau.debounceMs number 300 Pause duration in milliseconds before triggering completion.
tau.maxTokens number 64 Maximum tokens (num_predict) generated per suggestion.
tau.temperature number 0.0 Sampling temperature (0.0 ensures deterministic, logical code).
tau.maxPrefixLines number 100 Maximum preceding lines to include in the FIM prefix.
tau.maxSuffixLines number 50 Maximum following lines to include in the FIM suffix.

Troubleshooting

HTTP 400 "does not support insert" Error

If you see error logs indicating your model does not support insert, you are likely using an instruction/chat model (like codegemma:7b) rather than a dedicated code completion model.

  • Solution: Tau automatically falls back to completion without suffix when this occurs. For true FIM completion, pull a dedicated code model:
    ollama pull codegemma:7b-code
    # or
    ollama pull codegemma:2b

Status Bar Shows "$(error) Tau: Offline"

This indicates the extension cannot connect to the Ollama server at http://localhost:11434.

  • Solution: Ensure Ollama is running in your terminal (ollama serve) or desktop app, then click the status bar icon and select Re-check Ollama Connection.

Licensed under the MIT License.

About

Lightweight, ultra-fast inline code completion extension powered by Ollama and Codegemma.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages