java
The community/lang/java
directory contains files that add support for the Java programming language to Talon.
The core functionality is implemented in java.py
. This file defines a Talon context that activates when the current code language is Java. It defines lists of:
java_primitive_types
: Primitive types likeint
,boolean
, etc.java_boxed_types
: Boxed versions of primitive types likeInteger
,Boolean
, etc.java_common_classes
: Common classes likeObject
,String
, etc.java_generic_data_structures
: Generic data structures likeList
,Map
, etc.java_modifiers
: Modifiers likepublic
,private
,static
, etc.
These lists are used in java.talon
to create voice commands. The java.py
file also defines a number of UserActions
that are used to insert code snippets and operators using voice commands. These actions cover common operations such as:
- Operators like
+
,-
,==
, etc. - Control flow structures like
if
,else
,for
, etc. - Inserting
null
,true
,false
, and comments. - Defining functions with various modifiers.
The file java.talon
defines the voice commands that are used to interact with the code. It imports several code tags that provide additional functionality (e.g. user.code_imperative
, user.code_operators_math
). It also sets several settings that control the formatting of function and variable names.
The Talon file defines a number of commands for inserting code. For example:
boxed [type] {user.java_boxed_type}
: Inserts a boxed type.generic [type] {user.java_generic_data_structure}
: Inserts a generic type with angle brackets.type {user.code_type} array
: Inserts a type followed by array brackets.[state] {user.java_modifier}
: Inserts a Java modifier.op array
: Inserts array brackets.op new
: Insertsnew
keyword.
These files work together to provide a comprehensive set of voice commands for coding in Java. The java.py
file defines the core logic and data structures, while the java.talon
file provides the voice commands that users can use to interact with the code.