sql
This directory provides support for SQL within the Talon voice coding ecosystem. It defines the syntax rules, operator overrides, standard keywords, and common functions required to write SQL queries efficiently using voice commands.
The files in this directory work together to configure the SQL language context:
sql.pyestablishes the programming language context (code.language: sql) and overrides global programming behaviors to match SQL-specific syntax. It maps standard mathematical and logical operators—such as definingMATH_NOT_EQUALas<>and setting up logicalAND/ORoperators. It also implements actions for handling null checks (IS NULL,IS NOT NULL) and formats generic database function calls.sql.talondefines the voice command interface for SQL. It activates when editing a SQL file and enables spoken commands for database-centric operations. These include basic queries ("select", "select star from", "where", "group by"), joins ("inner join", "left outer join"), and structural formatting (like the "column" command to insert a comma and start a new line).code_common_function.talon-listpopulates the standard voice list for database-specific functions. It maps spoken names to SQL aggregate functions such asCount,Min, andMax, ensuring they conform to standard SQL dialect casing.
How They Work Together
When you open a SQL file, Talon detects the code.language: sql context.
- Operators & Actions:
sql.pyregisters standard SQL operator mappings. When generic programming commands (e.g., "op equal" or "op not equal") are spoken, they resolve to=and<>respectively instead of standard programming defaults like==and!=. - Voice Commands:
sql.talonconsumes these context-aware actions. When a user says "inner join", it leverages the genericuser.insert_betweenaction to outputINNER JOIN ONand places the cursor right in the middle for seamless entry. - Common Functions: Spoken functions defined in
code_common_function.talon-listare formatted dynamically using thecode_insert_functionhelper insql.py, utilizing snippets for consistent call structuring.