Ragex.Editor.Formatter
(Ragex v0.12.0)
View Source
Automatic code formatting integration.
Provides language-specific formatters that can be run after successful edits. Formatters are detected based on file extension and project structure.
Summary
Functions
Checks if a formatter is available for the given file or language.
Formats a file using the appropriate language formatter.
Functions
Checks if a formatter is available for the given file or language.
Examples
iex> Formatter.available?("lib/module.ex")
true
iex> Formatter.available?("file.txt")
false
Formats a file using the appropriate language formatter.
Parameters
path: Path to the file to formatopts: Options:language- Explicit language override:formatter- Explicit formatter command
Returns
:okif formatting succeeded or no formatter available{:error, reason}if formatting failed
Examples
iex> Formatter.format("lib/module.ex")
:ok
iex> Formatter.format("script", language: :python)
:ok