Skip to main content

edit_file

Function edit_file 

Source
pub fn edit_file(
    workspace: &Workspace,
    db_path: &Path,
    conn: &Connection,
    file_path: &str,
    old_text: &str,
    new_text: &str,
    occurrence: Occurrence,
) -> Result<TextEditResult, EditError>
Expand description

Atomically replaces old_text with new_text in one file.

The file is read from disk, so the caller needs no index of its content. An exact match wins; when there is none, the lines of old_text are matched with their indentation ignored.