feat: add fuzzy matching to recent files list with fuzzig
Many thanks to @fjebaker
This commit is contained in:
parent
5375e1449e
commit
0f5f41751e
5 changed files with 113 additions and 11 deletions
|
@ -237,11 +237,11 @@ const Process = struct {
|
|||
|
||||
fn query_recent_files(self: *Process, from: tp.pid_ref, project_directory: []const u8, max: usize, query: []const u8) error{ OutOfMemory, Exit }!void {
|
||||
const project = if (self.projects.get(project_directory)) |p| p else return tp.exit("No project");
|
||||
// const start_time = std.time.milliTimestamp();
|
||||
// project.sort_files_by_mtime();
|
||||
const start_time = std.time.milliTimestamp();
|
||||
const matched = try project.query_recent_files(from, max, query);
|
||||
_ = matched;
|
||||
// self.logger.print("queried: {s} for {s} match {d} in {d} ms", .{ project_directory, query, matched, std.time.milliTimestamp() - start_time });
|
||||
const query_time = std.time.milliTimestamp() - start_time;
|
||||
if (query_time > 250)
|
||||
self.logger.print("query \"{s}\" matched {d}/{d} in {d} ms", .{ query, matched, project.files.items.len, query_time });
|
||||
}
|
||||
|
||||
fn did_open(self: *Process, from: tp.pid_ref, project_directory: []const u8, file_path: []const u8, file_type: []const u8, language_server: []const u8, version: usize, text: []const u8) tp.result {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue