Inspiration

The inspiration struck during a late-night coding session when we realized how frustrating it is to use cutting-edge CSS features without knowing their browser support. We'd write beautiful code with CSS Grid, :has() selectors, or the new Temporal API, only to discover compatibility issues later.

The Baseline initiative by web-standards.org became our north star—but we needed a way to see this data live while coding. We imagined a "crystal ball" that could predict which features were safe to use, which were experimental, and everything in between. The wordplay of "Crystal-Line Base-Ball" perfectly captured our vision: a crystal ball for Baseline data with the approachable fun of America's pastime! ⚾🔮

What it does

Crystal-Line Base-Ball is a VS Code extension that provides real-time Baseline compatibility insights for CSS, HTML, and JavaScript features. It works like a coding crystal ball, revealing the future compatibility of web features as you type.

Key Features:

  • 🎯 Dual-Mode Visualization: Choose between classic gutter icons or modern text decorations
  • 🌈 Color-Coded Status: Green (baseline-ready), Orange (newly available), Purple (experimental)
  • 🔄 Multi-Layer Information: Switch between basic overviews, architecture insights, browser support timelines, and pro developer tips
  • 🌐 Full-Stack Coverage: CSS (nesting, :has(), Grid), HTML (dialog, popover, inert), JavaScript (Temporal, private fields, top-level await)
  • Rich Hover Tooltips: Beautiful markdown tooltips with emojis, compatibility timelines, and actionable insights

The extension automatically scans your code and highlights web features with their compatibility status, helping developers make informed decisions about which technologies to adopt.

How we built it

We built Crystal-Line Base-Ball using TypeScript and the VS Code Extension API, with a focus on creating a delightful developer experience:

Architecture Decisions

  • Pattern-Based Detection: Used regex patterns to identify web features across CSS, HTML, and JavaScript
  • Dual Decoration System: Implemented both gutterIconPath for classic gutter icons and TextEditorDecorationType for inline highlighting
  • Modular Feature Database: Created a comprehensive feature registry with status, descriptions, architecture insights, browser support, and pro tips
  • Event-Driven Updates: Leveraged onDidChangeActiveTextEditor and onDidChangeTextDocument for real-time scanning

Technical Implementation

// Dual decoration system
this.gutterDecorationTypes = {
  high: vscode.window.createTextEditorDecorationType({
    gutterIconPath: createSVGIcon('✅', '#22c55e'),
    overviewRulerLane: vscode.OverviewRulerLane.Right
  })
}

this.textDecorationTypes = {
  high: vscode.window.createTextEditorDecorationType({
    backgroundColor: 'rgba(34, 197, 94, 0.1)',
    border: '2px solid #22c55e'
  })
}

Build Pipeline

  • ESBuild for fast compilation and bundling
  • TypeScript for type safety and developer experience
  • ESLint for code quality and consistency
  • Yeoman generator for project scaffolding

Challenges we ran into

1. SVG Icon Generation for Gutter

Creating dynamic SVG icons for gutter decorations proved tricky. We solved this by generating base64-encoded SVG data URIs:

gutterIconPath: vscode.Uri.parse('data:image/svg+xml;base64,' + 
  Buffer.from(`<svg>...</svg>`).toString('base64'))

2. Regex Pattern Complexity

Detecting web features across three different languages required sophisticated regex patterns. For example, detecting top-level await without matching function-scoped await:

{ regex: /^(?!.*function).*await\s+/gm, feature: 'js-top-level-await' }

3. Performance Optimization

Real-time text scanning could impact performance. We optimized by:

  • Using efficient regex patterns with specific anchors
  • Implementing debounced document change listeners
  • Limiting decoration applications to visible editors

4. File Corruption During Development

Mid-development, our main extension file got corrupted during complex refactoring. We recovered by creating a clean backup and rebuilding with better separation of concerns.

Accomplishments that we're proud of

🎯 Innovation in Developer Tooling

We created the first VS Code extension that provides live Baseline compatibility insights with dual visualization modes—addressing a real pain point for modern web developers.

🌈 Comprehensive Web Platform Coverage

Unlike tools that focus on single technologies, Crystal-Line Base-Ball covers the entire web platform: CSS layout and styling, HTML semantic elements and APIs, and JavaScript language features and Web APIs.

🎨 Exceptional User Experience

We prioritized developer joy with:

  • Beautiful emoji-rich tooltips with markdown formatting
  • Smooth mode switching between visualization styles
  • Color psychology (green = safe, orange = caution, purple = experimental)
  • Intuitive command palette integration

Real-Time Performance

The extension provides instant feedback without impacting VS Code performance, scanning and highlighting features as developers type.

What we learned

VS Code Extension Architecture

We mastered the VS Code Extension API, learning how to:

  • Create sophisticated text decorations with both gutter and inline modes
  • Handle document events efficiently for real-time updates
  • Design command palette integration with categorized commands
  • Manage extension lifecycle and resource cleanup

Web Standards Deep Dive

Building the feature database required deep research into:

  • Baseline methodology and compatibility matrices
  • CSS Working Group specifications for cutting-edge features
  • TC39 proposal stages for JavaScript language evolution
  • WHATWG standards for HTML and Web API development

Developer Experience Design

We learned that great developer tools require:

  • Multiple information layers (basic, architecture, support, tips)
  • Visual flexibility (different developers prefer different highlighting styles)
  • Contextual information (not just "supported" but "why it matters")
  • Proactive guidance (when to use features, performance implications)

Regex Engineering

Crafting patterns to detect web features across three languages taught us advanced regex techniques:

  • Negative lookaheads: (?!.*function)
  • Word boundaries: \b for precise matching
  • Multi-line matching: /gm flags
  • Context-sensitive detection

What's next for Crystal-Line Base-Ball

🔮 Enhanced Prediction Capabilities

  • Timeline Predictions: Show projected Baseline dates for experimental features
  • Usage Analytics: Track which features developers use most
  • Custom Thresholds: Let teams define their own compatibility requirements

🌐 Expanded Web Platform Coverage

  • WebAssembly Features: WASI, component model, garbage collection
  • Progressive Web App APIs: Service workers, web app manifest, notification API
  • Performance APIs: Web Vitals, Performance Observer, User Timing
  • Accessibility Features: ARIA attributes, screen reader compatibility

🎯 Advanced Developer Insights

  • Polyfill Suggestions: Automatic recommendations for feature polyfills
  • Migration Guides: Step-by-step guides for adopting new features
  • Performance Impact: Real-world performance implications of features
  • Team Dashboards: Compatibility reports across codebases

🚀 Integration Ecosystem

  • CI/CD Integration: Compatibility reports in pull requests
  • Framework-Specific Modes: React, Vue, Angular feature detection
  • Build Tool Integration: Webpack, Vite, Rollup compatibility warnings
  • Design System Integration: Component library compatibility tracking

🔧 Enterprise Features

  • Custom Feature Databases: Organizations can define internal feature sets
  • Compliance Reporting: Generate compatibility reports for stakeholders
  • Multi-Repository Scanning: Cross-project compatibility analysis
  • Integration APIs: RESTful APIs for external tool integration

Crystal-Line Base-Ball represents the future of web development tooling—where developers have a crystal ball to see the compatibility implications of every line of code they write! 🔮⚾✨

Built With

  • css/html/javascript
  • esbuild
  • eslint
  • git/github
  • json-configuration
  • mocha
  • node.js
  • regex-pattern-matching
  • svg-graphics
  • typescript
  • vs-code-extension-api
Share this project:

Updates