feat: add command to toggle syntax highlighting (S-F10)

This commit is contained in:
CJ van den Berg 2024-10-12 20:26:40 +02:00
parent b31fb25478
commit 57dfa2ee9f

View file

@ -58,8 +58,15 @@ pub fn destroy(self: *Self) void {
self.allocator.destroy(self); self.allocator.destroy(self);
} }
pub fn reset(self: *Self) void {
if (self.tree) |tree| {
tree.destroy();
self.tree = null;
}
}
pub fn refresh_full(self: *Self, content: []const u8) !void { pub fn refresh_full(self: *Self, content: []const u8) !void {
if (self.tree) |tree| tree.destroy(); self.reset();
self.tree = try self.parser.parseString(null, content); self.tree = try self.parser.parseString(null, content);
} }