elixir
The community/lang/elixir
directory contains files that provide support for the Elixir programming language in Talon.
The core functionality is implemented in elixir.py
. This file defines a Talon context that is active when the current code language is Elixir. It provides lists of keywords and implements custom actions for:
- Inserting code comments, operators, and common values (true, false, null).
- Inserting control flow statements like
if
,else
,case
,for
, andwhile
with proper formatting. - Inserting function declarations (both public and private) using formatters.
- Importing, aliasing, requiring, and using modules.
The elixir.talon
file, found at elixir.talon
, defines:
- Tags that activate various Talon features specific to functional and concurrent programming, commenting, working with booleans and null, using functions, keywords, libraries, array operators, assignment operators, math operators, and lambda operators.
- Settings for formatting private and public functions and variables using snake case.
- Basic grammars for keywords and states like
def
,defp
,if
,else
,case
,cond
,try
,rescue
,after
, andend
- A grammar for inserting the pipe operator
|>
- A grammar for inserting raise and rescue statements with custom
user.elixir_exception
grammar.
These files work together to provide a cohesive experience when writing Elixir code using Talon. The .py
file handles the insertion and formatting of code, while the .talon
file sets up the context and enables common language features.