summaryrefslogtreecommitdiff
path: root/src/hunks.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/hunks.zig')
-rw-r--r--src/hunks.zig16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/hunks.zig b/src/hunks.zig
index 00d4cc97..00fe265b 100644
--- a/src/hunks.zig
+++ b/src/hunks.zig
@@ -162,7 +162,7 @@ pub fn sourceRoot(p: *Pardes, dir: []const u8, content: []const u8) []const u8 {
var base: []const u8 = dir;
for (0..8) |_| {
if (locations.sourceText(p, p.scratch.allocator(), base, path) != null) return base;
- base = std.fs.path.dirname(base) orelse return dir;
+ base = std.Io.Dir.path.dirname(base) orelse return dir;
}
return dir;
}
@@ -176,7 +176,7 @@ fn findSource(p: *Pardes, memo: *SourceMemo, dir: []const u8, path: []const u8)
var base: []const u8 = dir;
for (0..8) |_| {
if (locations.sourceText(p, arena, base, path)) |text| {
- memo.shown = if (base.ptr == dir.ptr) path else try std.fs.path.relativePosix(arena, "/", dir, text.path);
+ memo.shown = if (base.ptr == dir.ptr) path else try std.Io.Dir.path.relativePosix(arena, "/", dir, text.path);
var lines: std.ArrayList([]const u8) = .empty;
var split = std.mem.splitScalar(u8, text.bytes, '\n');
while (split.next()) |line| try lines.append(arena, std.mem.trimEnd(u8, line, "\r"));
@@ -188,7 +188,7 @@ fn findSource(p: *Pardes, memo: *SourceMemo, dir: []const u8, path: []const u8)
memo.declarations = try arena.dupe(syntax.ContextDeclaration, hit.analysis.declarations);
return;
}
- base = std.fs.path.dirname(base) orelse return;
+ base = std.Io.Dir.path.dirname(base) orelse return;
}
}
@@ -670,7 +670,7 @@ test "a hunk the file has moved since is found where it went, inside its declara
defer tmp.cleanup();
// Two lines more above it than the patch knows of.
try tmp.dir.writeFile(testing.io, .{ .sub_path = "a.zig", .data = "// one\n// two\nconst S = struct {\n fn f() void {\n a();\n b();\n }\n};\n" });
- var buf: [std.fs.max_path_bytes]u8 = undefined;
+ var buf: [std.Io.Dir.max_path_bytes]u8 = undefined;
const dir = buf[0..try tmp.dir.realPath(testing.io, &buf)];
const patch =
\\--- a.zig
@@ -722,11 +722,11 @@ test "a .patch looked at opens its +Diff, and Diff goes to the text and back" {
defer tmp.cleanup();
try tmp.dir.writeFile(testing.io, .{ .sub_path = "x.txt", .data = "b\n" });
try tmp.dir.writeFile(testing.io, .{ .sub_path = "c.patch", .data = "--- x.txt\n+++ x.txt\n@@ -1 +1 @@\n-a\n+b\n" });
- var buf: [std.fs.max_path_bytes]u8 = undefined;
+ var buf: [std.Io.Dir.max_path_bytes]u8 = undefined;
const dir = buf[0..try tmp.dir.realPath(testing.io, &buf)];
- const patch = try std.fs.path.join(testing.allocator, &.{ dir, "c.patch" });
+ const patch = try std.Io.Dir.path.join(testing.allocator, &.{ dir, "c.patch" });
defer testing.allocator.free(patch);
- const hunks_path = try std.fs.path.join(testing.allocator, &.{ dir, "+Diff" });
+ const hunks_path = try std.Io.Dir.path.join(testing.allocator, &.{ dir, "+Diff" });
defer testing.allocator.free(hunks_path);
const Count = struct {
fn of(pp: *Pardes, path: []const u8) usize {
@@ -784,7 +784,7 @@ test "a hunk edited since, beside siblings with its signature's tail, is found i
\\}
\\
});
- var buf: [std.fs.max_path_bytes]u8 = undefined;
+ var buf: [std.Io.Dir.max_path_bytes]u8 = undefined;
const dir = buf[0..try tmp.dir.realPath(testing.io, &buf)];
const patch =
\\--- a.rs