tracer
tracer copied to clipboard
feat: Major UX improvements - inline decorations, complexity overview, suggestions, Windows fix
Summary
This PR significantly improves the user experience of the Type Complexity Tracer extension, addressing multiple open issues and adding key new features.
New Features
1. Inline Type Complexity Decorations (like Error Lens)
- Shows type complexity metrics directly inline next to identifiers in the editor
- Color-coded severity levels:
- 🔴 Red: >2x proportional time (critical)
- 🟡 Yellow: >1.5x proportional time (warning)
- 🔵 Blue: >1.2x proportional time (info)
- 🟢 Green: >1x proportional time (hint)
- Toggle on/off via
Tracer: Toggle Inline Decorationscommand - Shows duration in ms and proportional percentage
2. Type Complexity Sidebar Panel
- New sidebar view in the activity bar showing all slow types in the project
- Sort by duration, proportional time, or identifier name
- Click any entry to navigate directly to the slow type location
- Shows file name, line number, and complexity metrics
3. Metrics Status Bar
- Real-time status bar showing:
- Number of slow types detected
- Average duration across all slow types
- Worst (slowest) type duration
- Color-coded background (red for critical, yellow for warning)
- Click to toggle inline decorations
4. Type Complexity Optimization Suggestions
- Quick fix code actions for tsperf diagnostics
- Contextual suggestions based on complexity patterns:
- Simplify complex types with many instantiations
- Extract subtypes to reduce total type count
- Reduce nesting depth for expensive types
- Use explicit interfaces instead of inferred types
- Cache results of expensive utility types (ReturnType, Parameters, etc.)
Bug Fixes
Fix: Windows path compatibility (Closes #48)
- Use double quotes on Windows, single quotes on Unix for shell commands
- Use
cd /don Windows for cross-drive navigation (e.g., D:\ to C:) - Properly handles non-C drive paths on Windows
Addresses Issues
- Closes #48 - Trace doesn't work if project isn't on C:/ drive
- Partially addresses #40 - use colors to help readability of trace lines
- Partially addresses #41 - better filtering (sidebar sort/filter)
- Partially addresses #42 - Trace analysis and suggestions
- Partially addresses #46 - visualizations (inline decorations)
Testing
- Build succeeds with
pnpm build - All new features are opt-in and don't break existing functionality
- Tested on Windows with cross-drive paths
Version
Bumped from 0.1.3 to 0.2.0