sql
The community/lang/sql
directory contains files to add support for SQL in Talon.
The most important files are:
-
sql.talon
: This file defines the voice commands for SQL. It includes common keywords likeselect
,from
,where
,order by
, andgroup by
, as well as commands for inserting different types of joins, and creatingwith
clauses. It also includes commands for inserting the.id
suffix, and for inserting dates. Thecolumn
command inserts a comma and a new line, which is useful when building lists of columns.The
sql.talon
file also tags the context withuser.code_operators_math
,user.code_comment_line
,user.code_comment_block_c_like
,user.code_data_null
, anduser.code_functions_common
, which allows it to inherit commands from other files and makes thesql
context easily extended with additional functionality. *sql.py
: This file defines the context for SQL and adds actions for inserting common SQL operators like+
,-
,*
,/
,=
,<>
,>
,>=
,<
,<=
,IN
,NOT IN
,AND
,OR
, andNULL
, as well as a function for inserting other functions and null checks.It also defines a list of common functions, which at the moment only includes
count
,min
, andmax
, but can be expanded on for different SQL dialects. The python file makes it so the talon commands for common operators, comments, null values, and function insertion are usable, as these actions are defined in python.
These two files work together to provide a complete set of commands for writing SQL code. The sql.talon
file provides the basic commands for SQL keywords, while sql.py
defines the context and provides actions for inserting operators, null values and functions. This allows the user to use simple voice commands to write SQL code more easily.