feat: add completion palette

This commit is contained in:
CJ van den Berg 2025-08-15 23:30:54 +02:00
parent 961090140a
commit 057a9d60cd
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
4 changed files with 190 additions and 5 deletions

View file

@ -351,6 +351,9 @@ pub const Editor = struct {
diag_hints: usize = 0,
completions: std.ArrayListUnmanaged(u8) = .empty,
completion_row: usize = 0,
completion_col: usize = 0,
completion_is_complete: bool = true,
enable_auto_save: bool,
enable_format_on_save: bool,
@ -5678,10 +5681,13 @@ pub const Editor = struct {
}
pub fn add_completion(self: *Self, row: usize, col: usize, is_incomplete: bool, msg: tp.message) Result {
if (!(row == self.completion_row and col == self.completion_col)) {
self.completions.clearRetainingCapacity();
self.completion_row = row;
self.completion_col = col;
}
try self.completions.appendSlice(self.allocator, msg.buf);
_ = row;
_ = col;
_ = is_incomplete;
self.completion_is_complete = is_incomplete;
}
pub fn select(self: *Self, ctx: Context) Result {