rfmt 1.2.5 → 1.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/Cargo.lock +1 -1
- data/ext/rfmt/Cargo.toml +1 -1
- data/ext/rfmt/src/emitter/mod.rs +19 -6
- data/lib/rfmt/rfmt.so +0 -0
- data/lib/rfmt/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b43c4cd99b99ae5b4525bc2efc9a3759e315cdbb200853345e2422d161fc58b6
|
|
4
|
+
data.tar.gz: e2f2f9fe52c401fadcd509e2705cbfca4a5bf0e84265f3ce7f764c1916e73470
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9e728fee6c041313543cd631255e9ac6fdc3a69c7a22f32b2846be6cbed6a59e1d1ba2dd46d989850e9ac6bc8d4b31bd630a4477e6d0d767ef7dd73c4a5c76ed
|
|
7
|
+
data.tar.gz: 6a7d78ae563cc30ae96970562ddf027005631ae9a2d79755b49a44411fc0f90a2c81ba48a29150c326cc5e5ad793159890f46ae2ee4658a0baeeef7f5907a3d1
|
data/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [1.2.6] - 2026-01-04
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
- Version bump
|
|
7
|
+
|
|
3
8
|
## [1.2.5] - 2026-01-04
|
|
4
9
|
|
|
5
10
|
### Fixed
|
|
6
11
|
- Fix trailing comments on `end` keyword (e.g., `end # rubocop:disable`)
|
|
7
12
|
- Fix block internal comments being moved outside the block
|
|
8
13
|
- Fix blank line preservation between code and comments inside blocks
|
|
14
|
+
- Fix leading blank line being added to comment-only files
|
|
9
15
|
|
|
10
16
|
## [1.2.4] - 2026-01-04
|
|
11
17
|
|
data/Cargo.lock
CHANGED
data/ext/rfmt/Cargo.toml
CHANGED
data/ext/rfmt/src/emitter/mod.rs
CHANGED
|
@@ -79,24 +79,37 @@ impl Emitter {
|
|
|
79
79
|
/// Emit all comments that haven't been emitted yet
|
|
80
80
|
fn emit_remaining_comments(&mut self, last_code_line: usize) -> Result<()> {
|
|
81
81
|
let mut last_end_line: Option<usize> = Some(last_code_line);
|
|
82
|
+
let mut is_first_comment = true;
|
|
83
|
+
|
|
82
84
|
for (idx, comment) in self.all_comments.iter().enumerate() {
|
|
83
85
|
if self.emitted_comment_indices.contains(&idx) {
|
|
84
86
|
continue;
|
|
85
87
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
+
|
|
89
|
+
// For the first remaining comment:
|
|
90
|
+
// - If buffer is empty, don't add any leading newline
|
|
91
|
+
// - If buffer has content, ensure we start on a new line
|
|
92
|
+
if is_first_comment && self.buffer.is_empty() {
|
|
93
|
+
// Don't add leading newline for first comment when buffer is empty
|
|
94
|
+
} else if !self.buffer.ends_with('\n') {
|
|
88
95
|
self.buffer.push('\n');
|
|
89
96
|
}
|
|
97
|
+
|
|
90
98
|
// Preserve blank lines between code/comments
|
|
91
|
-
if
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
99
|
+
// But only if this is not the first comment in an empty buffer
|
|
100
|
+
if !(is_first_comment && self.buffer.is_empty()) {
|
|
101
|
+
if let Some(prev_line) = last_end_line {
|
|
102
|
+
let gap = comment.location.start_line.saturating_sub(prev_line);
|
|
103
|
+
for _ in 1..gap {
|
|
104
|
+
self.buffer.push('\n');
|
|
105
|
+
}
|
|
95
106
|
}
|
|
96
107
|
}
|
|
108
|
+
|
|
97
109
|
writeln!(self.buffer, "{}", comment.text)?;
|
|
98
110
|
self.emitted_comment_indices.push(idx);
|
|
99
111
|
last_end_line = Some(comment.location.end_line);
|
|
112
|
+
is_first_comment = false;
|
|
100
113
|
}
|
|
101
114
|
Ok(())
|
|
102
115
|
}
|
data/lib/rfmt/rfmt.so
CHANGED
|
Binary file
|
data/lib/rfmt/version.rb
CHANGED