Skip to content

javascript

The community/lang/javascript directory provides Talon support for Javascript and Typescript development.

The file javascript.py defines the core logic for the Javascript/Typescript language support. It sets up a Talon context that activates when the code language is set to Javascript, Typescript, JavascriptReact, or TypescriptReact. This file defines lists for common functions, member functions, and keywords, enabling users to easily insert them with voice commands. It also defines a wide variety of actions for common coding tasks, including inserting code constructs like if, else, for, and while statements, as well as inserting operators, comments, and functions. It includes actions for inserting null checks (is null, is not null), and provides configurable function formatting.

The file javascript.talon provides the voice commands that tie into the python logic in javascript.py. It sets up tags to enable common code features like imperative and object oriented programming, C-like syntax, line and block comments, boolean and null values, functions, keywords, libraries, and common operators. The file also defines settings for formatting different types of variables and functions. There are voice commands for inserting code snippets like strict equality checks, null coalescing, variable declarations, and exports, plus async and await keywords. It includes voice commands for common member functions called in a dot chain, such as "dot map" or "dot filter". The file also defines a command for a from import, inserting from "" with the cursor between the quotes.