Skip to content

Commit f9f56af

Browse files
bartlomiejuclaude
andcommitted
fix: add separator between non-contiguous hunks in diff output
Emit a `...` separator line between hunks that have gaps (skipped unchanged lines), making it clear when diff output jumps across non-adjacent lines. Also remove unnecessary getrandom feature from dev-dependencies. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 8d30685 commit f9f56af

11 files changed

+24
-1
lines changed

libs/resolver/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,5 @@ url.workspace = true
6969

7070
[dev-dependencies]
7171
node_resolver.workspace = true
72-
sys_traits = { workspace = true, features = ["getrandom", "memory", "real", "serde_json"] }
72+
sys_traits = { workspace = true, features = ["memory", "real", "serde_json"] }
7373
test_util.workspace = true

libs/resolver/display.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,25 @@ impl<'a> DiffBuilder<'a> {
6060

6161
fn handle_diff(mut self, diff: Diff) -> String {
6262
let mut prev_before_end: u32 = 0;
63+
let mut is_first_hunk = true;
6364

6465
for hunk in diff.hunks() {
6566
// Skip unchanged lines between hunks
6667
let gap_len = (hunk.before.start - prev_before_end) as usize;
68+
if gap_len > 0 && !is_first_hunk {
69+
writeln!(
70+
self.output,
71+
"{:width$}{} {}",
72+
"",
73+
colors::gray(" |"),
74+
colors::gray("..."),
75+
width = self.line_number_width
76+
)
77+
.unwrap();
78+
}
6779
self.orig_line += gap_len;
6880
self.edit_line += gap_len;
81+
is_first_hunk = false;
6982

7083
// Interleave deleted/inserted line pairs, then emit remaining
7184
let del_count = hunk.before.len();
@@ -335,6 +348,7 @@ mod tests {
335348
" 4 | - \"npm:@denotest/add@1\": \"1.0.0\"\n",
336349
" 4 | + \"npm:@denotest/add@1\": \"1.0.0\",\n",
337350
" 5 | + \"npm:@denotest/subtract@1\": \"1.0.0\"\n",
351+
" | ...\n",
338352
"11 | + },\n",
339353
"12 | + \"@denotest/subtract@1.0.0\": {\n",
340354
"13 | + \"integrity\": \"def\",\n",

tests/specs/lockfile/frozen_lockfile/frozen_new_dep_cache.out

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ changes:
33
4 | - "npm:@denotest/add@1": "1.0.0"
44
4 | + "npm:@denotest/add@1": "1.0.0",
55
5 | + "npm:@denotest/subtract@1": "1.0.0"
6+
| ...
67
11 | + },
78
12 | + "@denotest/subtract@1.0.0": {
89
13 | + "integrity": "[WILDCARD]",

tests/specs/lockfile/frozen_lockfile/frozen_new_dep_dynamic_http.out

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
Download http://localhost:4545/welcome.ts
22
error: Uncaught (in promise) TypeError: The lockfile is out of date. Run `deno install --frozen=false`, or rerun with `--frozen=false` to update it.
33
changes:
4+
| ...
45
11 | + },
56
12 | + "remote": {
67
13 | + "http://localhost:4545/welcome.ts": "7353d5fcbc36c45d26bcbca478cf973092523b07c45999f41319820092b4de31"

tests/specs/lockfile/frozen_lockfile/frozen_new_dep_dynamic_jsr.out

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Download http://127.0.0.1:4250/@denotest/add/1.0.0/mod.ts
44
error: Uncaught (in promise) TypeError: The lockfile is out of date. Run `deno install --frozen=false`, or rerun with `--frozen=false` to update it.
55
changes:
66
4 | + "jsr:@denotest/add@1": "1.0.0",
7+
| ...
78
7 | + "jsr": {
89
8 | + "@denotest/add@1.0.0": {
910
9 | + "integrity": "[WILDCARD]"

tests/specs/lockfile/frozen_lockfile/frozen_new_dep_dynamic_npm.out

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ changes:
44
4 | - "npm:@denotest/add@1": "1.0.0"
55
4 | + "npm:@denotest/add@1": "1.0.0",
66
5 | + "npm:@denotest/subtract@1": "1.0.0"
7+
| ...
78
11 | + },
89
12 | + "@denotest/subtract@1.0.0": {
910
13 | + "integrity": "[WILDCARD]",
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
error: The lockfile is out of date. Run `deno install --frozen=false`, or rerun with `--frozen=false` to update it.
22
changes:
33
4 | + "jsr:@denotest/add@0.2.0": "0.2.0",
4+
| ...
45
8 | + "@denotest/add@0.2.0": {
56
9 | + "integrity": "[WILDCARD]"
67
10 | + },

tests/specs/lockfile/frozen_lockfile/frozen_new_dep_jsr_run.out

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Download http://127.0.0.1:4250/@denotest/add/0.2.0/mod.ts
33
error: The lockfile is out of date. Run `deno install --frozen=false`, or rerun with `--frozen=false` to update it.
44
changes:
55
4 | + "jsr:@denotest/add@0.2.0": "0.2.0",
6+
| ...
67
8 | + "@denotest/add@0.2.0": {
78
9 | + "integrity": "[WILDCARD]"
89
10 | + },

tests/specs/lockfile/frozen_lockfile/frozen_new_dep_run.out

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ changes:
44
4 | - "npm:@denotest/add@1": "1.0.0"
55
4 | + "npm:@denotest/add@1": "1.0.0",
66
5 | + "npm:@denotest/subtract@1": "1.0.0"
7+
| ...
78
11 | + },
89
12 | + "@denotest/subtract@1.0.0": {
910
13 | + "integrity": "[WILDCARD]",

tests/specs/lockfile/frozen_lockfile/frozen_package_json_changed.out

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ changes:
44
4 | - "npm:@denotest/add@1": "1.0.0"
55
4 | + "npm:@denotest/add@1": "1.0.0",
66
5 | + "npm:@denotest/bin@0.7.0": "0.7.0"
7+
| ...
78
11 | + },
89
12 | + "@denotest/bin@0.7.0": {
910
13 | + "integrity": "sha512-RAE7sQrdTUuV4KdDAshObhsULXb2QjTjfRg/KbzE9asZV8dUmwbPZy2kfmE2CunPo8+6DvwPklXFJ4PQi0Usuw==",

0 commit comments

Comments
 (0)