CLI Usage
Use Unfault from the terminal. Read more
In this tutorial, you’ll learn how to use the Unfault VS Code extension to understand your code’s runtime context as you write it. We’ll explore function impact, file centrality, the context sidebar, and how to configure the experience.
You’ll need:
unfault login)Cmd+Shift+X (macOS) or Ctrl+Shift+X (Windows/Linux)The extension activates automatically when you open a supported file.
After installation, you’ll see the Unfault icon in the status bar (bottom right):
┌─────────────────────────────────────────────────────────┐│ [$(unfault-logo)]│└─────────────────────────────────────────────────────────┘Click it to open the menu with all available actions.
The icon changes based on context:
| Display | Meaning |
|---|---|
$(unfault-logo) | Extension running; open a supported file for context |
$(unfault-logo) 3 | 3 diagnostics in current file (when enabled) |
$(unfault-logo) $(star) | Moderately central file (more dependents) |
$(unfault-logo) $(hub) | Hub file (many dependents) |
$(unfault-logo) $(loading~spin) | Server starting |
$(unfault-logo) (yellow background) | Server stopped/error (click for menu) |
The most visible feature is code lenses. Above each function, Unfault shows what it knows:
# uf: used by 3 places · reached by POST /api/checkout · worth a lookdef process_payment(user_id: str, amount: float): response = requests.post(PAYMENT_API, json={"user": user_id, "amount": amount}) return response.json()The code lens tells you:
Click the code lens to open the Context sidebar with full details.
The Context sidebar lives in the Explorer panel. It shows detailed information about the function under your cursor.
Unfault groups observations so you can quickly tell where an issue lives:
worth a look in the code lens)┌─────────────────────────────────────────┐│ UNFAULT: CONTEXT 📌 │├─────────────────────────────────────────┤│ process_payment ││ ││ CALLERS ││ ├─ checkout_handler (routes/api.py) ││ ├─ retry_payment (routes/api.py) ││ └─ BackgroundTask (workers/payments.py) ││ ││ ROUTES ││ ├─ POST /api/checkout ││ │ └─ 99.9% Availability SLO ││ └─ POST /api/retry-payment ││ ││ HEADS UP ││ ├─ ⚠ No timeout on HTTP call ││ └─ ⚠ No circuit breaker ││ ││ UPSTREAM ││ └─ ⚠ Caller does not handle errors ││ ││ DOWNSTREAM ││ └─ ⚠ Callee has no retries │└─────────────────────────────────────────┘By default, the sidebar follows your cursor. As you move between functions, it updates to show the context for wherever you are.
Click the pin icon (📌) to lock the sidebar on a specific function. This is useful when you want to keep context visible while editing elsewhere.
When you open a file, Unfault calculates how central it is to your codebase:
The status bar shows this with icons, and hovering reveals details:
┌─────────────────────────────────────┐│ Unfault: Context ││ ││ File Importance ││ - Imported by: 12 files ││ - Imports: 4 files ││ ││ Dependents ││ - 18 files depend on this ││ ││ ─────────────────────────────────── ││ Click for menu │└─────────────────────────────────────┘When you’re about to change a central file, you might want to know exactly what depends on it.
A picker appears listing all files that import this one:
┌─────────────────────────────────────────────────────────┐│ 12 files depend on src/core/auth.py │├─────────────────────────────────────────────────────────┤│ users.py src/api/routes/users.py Direct ││ admin.py src/api/routes/admin.py Direct ││ payments.py src/api/routes/payments.py Transitive ││ ... │└─────────────────────────────────────────────────────────┘Select a file to open it.
By default, Unfault doesn’t show squiggly underlines. The philosophy is “calm mode” - context is available when you want it, but it doesn’t interrupt your flow.
If you prefer inline diagnostics:
Cmd+,)def fetch_data(): # Yellow squiggle under requests.get response = requests.get(url) # ⚠ HTTP call has no timeout return response.json()When enabled, findings appear as squiggles with hover explanations.
Click the Unfault status bar item to access all commands:
┌─────────────────────────────────────────────────────────┐│ Unfault - Select an action │├─────────────────────────────────────────────────────────┤│ $(unfault-logo) Open Context Open context sidebar ││ $(home) Welcome & Setup Onboarding + auth help ││ $(references) Show File Dependents Show dependents ││ $(gear) Open Settings Configure settings ││ $(output) Show Output View LSP logs ││ $(refresh) Restart Server Restart the LSP server ││ $(book) Documentation Open unfault.dev/docs │└─────────────────────────────────────────────────────────┘Names and icons may vary slightly based on your VS Code theme and version, but the items map directly to the Unfault commands listed in the Command Palette.
Open Settings and search for “unfault” to see all options:
| Setting | Description | Default |
|---|---|---|
unfault.executablePath | Path to unfault CLI | unfault |
unfault.codeLens.enabled | Show code lenses above functions | true |
unfault.codeLens.clickToOpen | Click lens to open context sidebar | true |
unfault.diagnostics.enabled | Show inline squiggles | false |
unfault.diagnostics.minSeverity | Minimum severity to show | high |
unfault.trace.server | LSP trace level | off |
unfault.verbose | Enable verbose logging | false |
| Shortcut | Action |
|---|---|
| Click the Unfault status bar item | Open Unfault menu |
| Click a code lens | Open context sidebar |
Cmd+Shift+P → “Unfault” | See all commands |
The CLI isn’t in your PATH. Either:
unfault to your PATHunfault.executablePath in VS Code settings to the full pathThe menu item opens https://unfault.dev/docs. For extension-specific docs, see:
/docs/guides/vscode//docs/tutorials/vscode-extension/unfault.codeLens.enabled is trueunfault login in the terminalThe first time you open a file, Unfault builds a semantic graph. Subsequent interactions use the cached graph and should be fast.
In this tutorial, you: