fix: translate columns to byte offsets when requesting completions

This commit is contained in:
CJ van den Berg 2025-10-02 16:28:23 +02:00
parent 6ec8aae94a
commit 5362706b26
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -5520,9 +5520,11 @@ pub const Editor = struct {
pub fn completion(self: *Self, _: Context) Result {
const file_path = self.file_path orelse return;
const root = self.buf_root() catch return;
const primary = self.get_primary();
const col = try root.get_line_width_to_pos(primary.cursor.row, primary.cursor.col, self.metrics);
self.completions.clearRetainingCapacity();
return project_manager.completion(file_path, primary.cursor.row, primary.cursor.col);
return project_manager.completion(file_path, primary.cursor.row, col);
}
pub const completion_meta: Meta = .{ .description = "Language: Show completions at cursor" };