Compare commits

..

No commits in common. "2a74de8f73458ebfe46040559626d72adcf2f53b" and "0221af1286fc419c2fb1caedd9b5f445254d7129" have entirely different histories.

View file

@ -174,10 +174,10 @@ pub fn render(self: *const Self, ctx: anytype, comptime cb: CallBack(@TypeOf(ctx
} }
} }
pub fn highlights_at_point(self: *const Self, ctx: anytype, comptime cb: CallBack(@TypeOf(ctx)), point: Point) bool { pub fn highlights_at_point(self: *const Self, ctx: anytype, comptime cb: CallBack(@TypeOf(ctx)), point: Point) void {
const cursor = Query.Cursor.create() catch return false; const cursor = Query.Cursor.create() catch return;
defer cursor.destroy(); defer cursor.destroy();
const tree = self.tree orelse return false; const tree = self.tree orelse return;
cursor.execute(self.query, tree.getRootNode()); cursor.execute(self.query, tree.getRootNode());
cursor.setPointRange(.{ .row = point.row, .column = 0 }, .{ .row = point.row + 1, .column = 0 }); cursor.setPointRange(.{ .row = point.row, .column = 0 }, .{ .row = point.row + 1, .column = 0 });
while (cursor.nextMatch()) |match| { while (cursor.nextMatch()) |match| {
@ -187,11 +187,11 @@ pub fn highlights_at_point(self: *const Self, ctx: anytype, comptime cb: CallBac
const end = range.end_point; const end = range.end_point;
const scope = self.query.getCaptureNameForId(capture.id); const scope = self.query.getCaptureNameForId(capture.id);
if (start.row == point.row and start.column <= point.column and point.column < end.column) if (start.row == point.row and start.column <= point.column and point.column < end.column)
cb(ctx, range, scope, capture.id, 0, &capture.node) catch return true; cb(ctx, range, scope, capture.id, 0, &capture.node) catch return;
break; break;
} }
} }
return false; return;
} }
pub fn node_at_point_range(self: *const Self, range: Range) error{Stop}!treez.Node { pub fn node_at_point_range(self: *const Self, range: Range) error{Stop}!treez.Node {