Function formattedDiff

  • Non destructively perform a formatted diff using git to diff on words

    The underlying git command behind this is: git diff --word-diff=color --word-diff-regex=. file1 file2

    Parameters

    • originalFilePath: string

      the path to the original file on disk

    • modifiedFilePath: string

      the path to the modified file on disk

    Returns Promise<{
        diff: string;
        diffCommand: string;
        directory: string;
    }>

    the return value contains the path to the directory for further inspection, the terminal-printable diff (output of git diff) which can be printed to the console, and the diffCommand to generate the diff for use in other tooling