Skip to main content
Alvin QuachFull Stack Developer
HomeProjectsExperienceBlog
HomeProjectsExperienceBlog
alvinquach

Full Stack Developer building systems that respect complexity.

Open to opportunities

AQ

Projects

  • All Projects
  • Hoparc Physical Therapy
  • OpportunIQ
  • Hoop Almanac
  • SculptQL

Knowledge

  • Blog
  • Experience
  • Interview Prep

Connect

  • Contact
  • LinkedIn
  • GitHub
  • X

Resources

  • Resume
© 2026All rights reserved.
Back to Blog
March 2, 2026 1 min read

Building Context-Aware SQL Autocompletion with CodeMirror 6

Build Log
Featured
Depth: ●●●○○
Share:

How I built a SQL autocompletion engine that understands cursor position: FK-based JOIN conditions after ON, aggregate functions in HAVING, and schema-aware columns after SELECT.

Three-Layer Architecture

Layer 1: Context Detection parses SQL around cursor to determine clause. Layer 2: 14 Clause-Specific Handlers know what's valid (joinHandler suggests FK-based ON conditions, havingHandler suggests aggregates). Layer 3: 12 Suggestion Generators build CodeMirror completion items.

The Killer Feature

After JOIN, the system looks up foreign key relationships and suggests related tables with pre-filled ON conditions. No other SQL editor does this automatically for arbitrary databases.

Related Projects

SculptQL

Share

Share:

Explore more

ProjectsExperienceRequest a call

Importance

★★★★★