proto
This directory provides voice coding support for Protocol Buffers (Protobuf) in Talon. It is designed to make writing and editing .proto schema files efficient by defining standard Protobuf keywords, structures, and data types.
The support is implemented through two files that work in tandem:
- proto.py: This script activates when the active file's language is set to
protobuf. It defines a list of standard Protocol Buffer data types and maps them to intuitive spoken forms (e.g., "you sixty four" foruint64, "eye thirty two" forint32, and "sin sixty four" forsint64). - proto.talon: This file contains the voice commands that are enabled when editing Protobuf files. It defines commands for common schema structures, declarations, and operators.
How They Work Together
When you open a Protocol Buffer file, Talon detects the code.language: protobuf context. This triggers the configuration in proto.py to populate the user.code_type list with Protobuf-specific types.
Once this context is active, proto.talon maps spoken phrases to text generation:
-
Structure and Keywords: You can declare blocks, messages, packages, and imports using commands like:
- "state message" ->
message - "state package" ->
package - "state import" ->
import - "state enum" ->
enum
- "state message" ->
-
Operators: "op equals" inserts the assignment operator
=, which is frequently used for defining field tags in Protobuf. -
Type Declarations: By referencing the
user.code_typelist populated by the Python file, you can quickly write out types:- Saying "type double" will output
double. - Saying "repeated type you thirty two" will output
repeated uint32.
- Saying "type double" will output