Ragex.Editor.Preview
(Ragex v0.8.0)
View Source
Preview mode for refactoring operations.
Provides dry-run capabilities to see what changes would be made without actually modifying files.
Summary
Functions
Generates a preview of changes for a refactoring operation.
Types
@type file_preview() :: %{ path: String.t(), diff: Ragex.Editor.Diff.diff_result(), formatted_diff: String.t() }
@type preview_result() :: %{ operation: atom(), files: [file_preview()], stats: %{ files_affected: non_neg_integer(), total_additions: non_neg_integer(), total_deletions: non_neg_integer() }, warnings: [String.t()] }
Functions
@spec generate_preview( atom(), %{required(String.t()) => {String.t(), String.t()}}, keyword() ) :: {:ok, preview_result()}
Generates a preview of changes for a refactoring operation.
Parameters
operation: Operation name (e.g., :rename_function)changes: Map of file_path => {old_content, new_content}opts: Options:format- Diff format (:unified, :side_by_side, :json, :html):context_lines- Context lines in diff (default: 3)
Returns
{:ok, preview_result}with diffs for all affected files