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

@ -207,7 +207,7 @@ const cmds = struct {
file = file_name;
} else return tp.exit_error(error.InvalidArgument);
const f = normalize_file_path(file orelse return);
const f = project_manager.normalize_file_path(file orelse return);
const same_file = if (self.editor) |editor| if (editor.file_path) |fp|
std.mem.eql(u8, fp, f)
else
@ -462,15 +462,6 @@ fn read_restore_info(self: *Self) !void {
}
}
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;
}
fn push_file_stack(self: *Self, file_path: []const u8) !void {
for (self.file_stack.items, 0..) |file_path_, i|
if (std.mem.eql(u8, file_path, file_path_))