Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Fixed handling of floor division (`//`) syntax when only Luau FFlag is enabled
- Fixed missing space when table is inside of Luau interpolated string expression (`{{` is invalid syntax)
- The CLI tool will now only write files if the contents differ, and not modify if no change (#827)

## [0.19.1] - 2023-11-15

Expand Down
6 changes: 4 additions & 2 deletions src/cli/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,10 @@ fn format_file(
None => Ok(FormatResult::Complete),
}
} else {
fs::write(path, formatted_contents)
.with_context(|| format!("could not write to {}", path.display()))?;
if formatted_contents != contents {
fs::write(path, formatted_contents)
.with_context(|| format!("could not write to {}", path.display()))?;
}
Ok(FormatResult::Complete)
}
}
Expand Down