feat(mod_format): feat(mod_format): use unified diff formatter with filenames and context in BaseFormatter.displayDiff

This commit is contained in:
2025-12-15 17:24:17 +00:00
parent 4bb1a2f8c7
commit 601e0d1063
3 changed files with 13 additions and 2 deletions

View File

@@ -143,7 +143,11 @@ export abstract class BaseFormatter {
displayDiff(diff: ICheckResult['diffs'][0]): void {
console.log(`\n--- ${diff.path}`);
if (diff.before && diff.after) {
console.log(plugins.smartdiff.formatLineDiffForConsole(diff.before, diff.after));
console.log(plugins.smartdiff.formatUnifiedDiffForConsole(diff.before, diff.after, {
originalFileName: diff.path,
revisedFileName: diff.path,
context: 3,
}));
} else if (diff.after && !diff.before) {
console.log(' (new file)');
// Show first few lines of new content