Terminal-Lens
Supercharge your debugging workflow with AI-powered terminal diagnostics.
Terminal-Lens automatically scans your integrated VS Code terminal for stack traces, error paths, and exceptions in real-time. It turns these errors into auto-diagnostics (red squiggles) and inline Code Lenses in your editor. Click the lens, or use the interactive terminal links, to open an AI-powered Chat Interface that explains exactly what went wrong and lets you apply the fix with a single click!
Features
- Auto-Diagnostics & Code Lenses: Terminal-Lens listens to your terminal output and automatically places error squiggles and a
✨ AI: Analyze Terminal Error Code Lens right above the failing line in your code. No manual searching needed!
- Conversational AI Chat: Ask follow-up questions, request different solutions, and chat directly with the AI inside a beautifully rendered, theme-aware webview.
- One-Click "Apply Fix": When the AI suggests code, a "✨ Apply Fix" button appears. Click it to instantly apply the drop-in replacement directly to your file using native Workspace Edits.
- Instant Error Navigation: You can also hold
Ctrl / Cmd and click any terminal error path (e.g., src/app.ts:15:5) to trigger the AI analysis.
- Native AI Integration: Integrates seamlessly with top-tier LLMs to diagnose your specific error within the context of your codebase.
- Multi-Provider Support: Choose the AI that works best for you. Terminal-Lens supports OpenAI, Anthropic, Cohere, and even Ollama for completely free, private, local execution.
- Language Agnostic: The regex engine automatically identifies stack traces from Node.js, Python, Rust, Go, C++, and more.
- Custom Ignore Patterns: Avoid scanning noisy directories like
node_modules or .git by customizing your ignore lists.
Getting Started
- Install the Extension: Download Terminal-Lens from the VS Code Marketplace.
- Open Settings: Press
Ctrl + , (Windows/Linux) or Cmd + , (Mac) to open your VS Code Settings.
- Configure Terminal-Lens: Type
Terminal Lens into the settings search bar.
- Choose your AI:
- Select your preferred AI from the
Ai Provider dropdown.
- Paste your API key into the
Ai Api Key field. (Note: If you select ollama, no API key is required!)
How to Use
- Run your code in the integrated VS Code terminal.
- If an error or stack trace occurs, Terminal-Lens will automatically put a red error squiggle and a Code Lens on the failing line in your active editor.
- Click the
✨ AI: Analyze Terminal Error Code Lens above the broken code.
- A chat panel will open, and the AI will analyze the error and the surrounding code context.
- If the AI provides a code block with a fix, click the ✨ Apply Fix button to instantly patch your file!
- Alternatively, you can always
Ctrl + Click (or Cmd + Click) the file path link directly in the terminal output to trigger the same workflow.
Extension Settings
This extension contributes the following settings:
| Setting |
Default |
Description |
terminalLens.aiProvider |
openai |
Choose between openai, anthropic, cohere, or ollama. |
terminalLens.aiApiKey |
"" |
The API Key for your selected cloud provider. |
terminalLens.ignoredPatterns |
["node_modules", "vendor", ".git"] |
Folders or regex patterns to ignore when scanning for terminal links. |
Using Ollama (Local & Free)
If you want to run your AI diagnostics locally without paying for API keys:
- Download and install Ollama.
- Run
ollama run llama3 (or any model of your choice) in your terminal to download the model.
- Keep the Ollama application running in the background.
- Set the
Ai Provider to ollama in the Terminal-Lens settings.
Built with ❤️ for developers who hate copying and pasting stack traces.
| |