kotlin
This directory provides support for the Kotlin programming language within the Talon voice coding environment. It integrates Kotlin-specific keywords, types, operators, and formatting conventions into the unified Talon programming interface.
How it Works
The Kotlin support is split into two core files:
- kotlin.py: Implements the programmatic behavior, context matching, lists (keywords and types), and actions.
- kotlin.talon: Activates standard programming capabilities (tags) and configures naming conventions (settings) when editing a Kotlin file.
File Breakdown
kotlin.py
This Python script is activated when the active file's language is set to kotlin. It performs several key tasks:
- Keyword and Type Lists: Populates Talon's global lists (
user.code_keywordanduser.code_type) with Kotlin-specific vocabulary (such asval,var,lateinit,companion object, and standard types likeInt,Boolean, andNothing). - Operators Configuration: Defines standard mathematical, assignment, array, and bitwise operators using a structured
Operatorsclass. It also configures Kotlin's lambda symbol (->). - Custom Action Implementations: Overrides standard Talon coding actions to match Kotlin syntax:
- Inserts
thisfor self-referencing. - Provides specialized helper functions for
nullchecks (== null,!= null). - Dynamically builds function definitions (e.g.,
fun myFunction()orprivate fun myFunction()) using the appropriate casing formatters.
- Inserts
kotlin.talon
This file configures the voice environment when working inside Kotlin files:
- Enables Language Capabilities: Activates standard Talon tags that grant access to generalized voice commands for object-oriented programming, imperative control flow, comments, data structures, and mathematical operators.
- Language-Specific Formatting: Sets the variable and function formatting settings. In Kotlin, public, private, and protected functions and variables all default to
PRIVATE_CAMEL_CASE(e.g.,camelCaseName).