fix: open competion palette after all completions are received
This commit is contained in:
parent
03c82999b8
commit
42b7ae46a0
2 changed files with 25 additions and 5 deletions
|
@ -1012,6 +1012,7 @@ fn send_completion_items(to: tp.pid_ref, file_path: []const u8, row: usize, col:
|
|||
if (!(try cbor.matchValue(&iter, cbor.extract_cbor(&item)))) return error.InvalidMessageField;
|
||||
try send_completion_item(to, file_path, row, col, item, if (len > 1) true else is_incomplete);
|
||||
}
|
||||
return to.send(.{ "cmd", "add_completion_done", .{ file_path, row, col } }) catch error.ClientFailed;
|
||||
}
|
||||
|
||||
fn invalid_field(field: []const u8) error{InvalidMessage} {
|
||||
|
|
|
@ -838,11 +838,8 @@ const cmds = struct {
|
|||
tp.more,
|
||||
})) return error.InvalidAddDiagnosticArgument;
|
||||
file_path = project_manager.normalize_file_path(file_path);
|
||||
if (self.get_active_editor()) |editor| {
|
||||
if (std.mem.eql(u8, file_path, editor.file_path orelse ""))
|
||||
if (self.get_active_editor()) |editor| if (std.mem.eql(u8, file_path, editor.file_path orelse ""))
|
||||
try editor.add_completion(row, col, is_incomplete, ctx.args);
|
||||
try tui.open_overlay(@import("mode/overlay/completion_palette.zig").Type);
|
||||
}
|
||||
}
|
||||
pub const add_completion_meta: Meta = .{
|
||||
.arguments = &.{
|
||||
|
@ -871,6 +868,28 @@ const cmds = struct {
|
|||
},
|
||||
};
|
||||
|
||||
pub fn add_completion_done(self: *Self, ctx: Ctx) Result {
|
||||
var file_path: []const u8 = undefined;
|
||||
var row: usize = undefined;
|
||||
var col: usize = undefined;
|
||||
|
||||
if (!try ctx.args.match(.{
|
||||
tp.extract(&file_path),
|
||||
tp.extract(&row),
|
||||
tp.extract(&col),
|
||||
})) return error.InvalidAddDiagnosticArgument;
|
||||
file_path = project_manager.normalize_file_path(file_path);
|
||||
if (self.get_active_editor()) |editor| if (std.mem.eql(u8, file_path, editor.file_path orelse ""))
|
||||
try tui.open_overlay(@import("mode/overlay/completion_palette.zig").Type);
|
||||
}
|
||||
pub const add_completion_done_meta: Meta = .{
|
||||
.arguments = &.{
|
||||
.string, // file_path
|
||||
.integer, // row
|
||||
.integer, // col
|
||||
},
|
||||
};
|
||||
|
||||
pub fn rename_symbol_item(self: *Self, ctx: Ctx) Result {
|
||||
const editor = self.get_active_editor() orelse return;
|
||||
// because the incoming message is an array of Renames, we manuallly
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue