feat: render diagnostics (part 1)

This commit is contained in:
CJ van den Berg 2024-04-17 23:26:19 +02:00
parent 33dd4486eb
commit e41c2d34f7
4 changed files with 67 additions and 14 deletions

View file

@ -564,3 +564,13 @@ fn walk_filtered(dir: std.fs.Dir, allocator: std.mem.Allocator) !FilteredWalker
.name_buffer = name_buffer,
};
}
pub fn normalize_file_path(file_path: []const u8) []const u8 {
const project = tp.env.get().str("project");
if (project.len == 0) return file_path;
if (project.len >= file_path.len) return file_path;
if (std.mem.eql(u8, project, file_path[0..project.len]) and file_path[project.len] == std.fs.path.sep)
return file_path[project.len + 1 ..];
return file_path;
}