Skip to main content

Module format

Module format 

Source
Expand description

Formatter routing for ctx_refactor action=reformat: pick a formatter by file extension, using built-in routing per extension.

Enums§

Formatter
The formatter selected for a file: either the IDE HTTP backend or an external shell command (template with a {file} placeholder).

Functions§

blake3_of
Hex BLAKE3 of the file content, for honest before/after change detection.
build_argv
Split a command template into argv, substituting the {file} placeholder with abs_path. {file} may be a standalone token or embedded in a token. If no placeholder is present, abs_path is appended as the final argument. The path is always a single argv element (spaces in the path are preserved).
command_label
The binary name of a command template, for the via <name> output label.
resolve_formatter
Pick the formatter for abs_path using built-in defaults per extension. Extension match is case-insensitive; no extension or an unknown extension → Jetbrains.
run_command_formatter
Run an external formatter command on abs_path with cwd project_root (so tool config like rustfmt.toml is discovered). Returns Err with a clear message if the binary is missing or the command exits non-zero.