Skip to content

Using the VS Code Extension

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:

  • VS Code installed
  • The Unfault CLI installed and authenticated (unfault login)
  • A project with Python, Go, Rust, TypeScript, or JavaScript code
  1. Open VS Code
  2. Press Cmd+Shift+X (macOS) or Ctrl+Shift+X (Windows/Linux)
  3. Search for “Unfault”
  4. Click Install

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:

DisplayMeaning
$(unfault-logo)Extension running; open a supported file for context
$(unfault-logo) 33 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 look
def 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:

  • used by 3 places: This function is called from 3 locations
  • reached by POST /api/checkout: It’s in the call chain of an HTTP route
  • worth a look: There’s something to consider (findings exist)

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:

  • Heads up: findings about the current function body (this is what triggers worth a look in the code lens)
  • Upstream: issues in callers and entry paths into the function (things that can break you)
  • Downstream: issues in functions you call (things you rely on / can propagate)
┌─────────────────────────────────────────┐
│ 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:

  • Hub files are imported by many other files. Changes here have wide impact.
  • Leaf files have few dependents. Safer to modify.

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.

  1. Open a file
  2. Click the status bar icon
  3. Select Show File Dependents (or run Unfault: Show Files That Depend on This File)

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:

  1. Open Settings (Cmd+,)
  2. Search for “unfault diagnostics”
  3. Enable Unfault: Diagnostics Enabled
  4. Set Unfault: Diagnostics Min Severity (default: high)
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:

SettingDescriptionDefault
unfault.executablePathPath to unfault CLIunfault
unfault.codeLens.enabledShow code lenses above functionstrue
unfault.codeLens.clickToOpenClick lens to open context sidebartrue
unfault.diagnostics.enabledShow inline squigglesfalse
unfault.diagnostics.minSeverityMinimum severity to showhigh
unfault.trace.serverLSP trace leveloff
unfault.verboseEnable verbose loggingfalse
ShortcutAction
Click the Unfault status bar itemOpen Unfault menu
Click a code lensOpen context sidebar
Cmd+Shift+P → “Unfault”See all commands

The CLI isn’t in your PATH. Either:

  • Add the directory containing unfault to your PATH
  • Set unfault.executablePath in VS Code settings to the full path

”Documentation” menu opens the wrong page

Section titled “”Documentation” menu opens the wrong page”

The menu item opens https://unfault.dev/docs. For extension-specific docs, see:

  • Guide: /docs/guides/vscode/
  • Tutorial: /docs/tutorials/vscode-extension/
  1. Make sure you’re in a supported file (Python, Go, Rust, TypeScript, JavaScript)
  2. Check that unfault.codeLens.enabled is true
  3. Run Unfault: Restart Server from the command palette
  4. Check the Output panel (Unfault: Show Output) for errors
  1. Ensure you’ve run unfault login in the terminal
  2. Check network connectivity to app.unfault.dev
  3. The first analysis may take a moment as the graph builds

The 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:

  • Installed the VS Code extension
  • Understood code lenses and what they show
  • Used the Context sidebar to explore function impact
  • Learned about file centrality and dependents
  • Optionally enabled inline diagnostics
  • Configured the extension to your preferences

CLI Usage

Use Unfault from the terminal. Read more

Explore the Code Graph

Deeper dependency analysis. Read more

Configuration

Project-level settings. Read more