feat: request vcs id and content when opening or restoring files
This commit is contained in:
parent
2a3210a183
commit
6dba3609af
2 changed files with 4 additions and 1 deletions
|
|
@ -709,6 +709,8 @@ pub const Editor = struct {
|
||||||
new_buf.is_ephemeral(),
|
new_buf.is_ephemeral(),
|
||||||
) catch |e|
|
) catch |e|
|
||||||
self.logger.print("project_manager.did_open failed: {any}", .{e});
|
self.logger.print("project_manager.did_open failed: {any}", .{e});
|
||||||
|
if (!new_buf.is_ephemeral())
|
||||||
|
project_manager.request_vcs_id(file_path) catch {};
|
||||||
};
|
};
|
||||||
break :syntax syn;
|
break :syntax syn;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1860,6 +1860,8 @@ fn send_buffer_did_open(allocator: std.mem.Allocator, buffer: *Buffer) !void {
|
||||||
try content.toOwnedSlice(),
|
try content.toOwnedSlice(),
|
||||||
buffer.is_ephemeral(),
|
buffer.is_ephemeral(),
|
||||||
);
|
);
|
||||||
|
if (!buffer.is_ephemeral())
|
||||||
|
project_manager.request_vcs_id(buffer.get_file_path()) catch {};
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_next_mru_buffer(self: *Self, mode: enum { all, hidden, non_hidden }) ?[]const u8 {
|
fn get_next_mru_buffer(self: *Self, mode: enum { all, hidden, non_hidden }) ?[]const u8 {
|
||||||
|
|
@ -1964,6 +1966,5 @@ pub fn vcs_content_update(self: *Self, m: tp.message) void {
|
||||||
if (m.match(.{ "PRJ", "vcs_content", tp.extract(&file_path), tp.extract(&vcs_id), tp.extract(&content) }) catch return) {
|
if (m.match(.{ "PRJ", "vcs_content", tp.extract(&file_path), tp.extract(&vcs_id), tp.extract(&content) }) catch return) {
|
||||||
const buffer = self.buffer_manager.get_buffer_for_file(file_path) orelse return;
|
const buffer = self.buffer_manager.get_buffer_for_file(file_path) orelse return;
|
||||||
buffer.set_vcs_content(vcs_id, content) catch {};
|
buffer.set_vcs_content(vcs_id, content) catch {};
|
||||||
std.log.debug("vcs_content: {d} bytes of {d} id:{s}", .{ content.len, (buffer.get_vcs_content() orelse &.{}).len, vcs_id });
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue