feat: WIP add project manager service

The project manager service will provide fuzzy find, LRU, and similar
background services for open projects.
This commit is contained in:
CJ van den Berg 2024-03-21 22:52:44 +01:00
parent a056a54104
commit 602a4dff01
5 changed files with 400 additions and 4 deletions

View file

@ -4,6 +4,7 @@ const tp = @import("thespian");
const tracy = @import("tracy");
const root = @import("root");
const location_history = @import("location_history");
const project_manager = @import("project_manager");
const tui = @import("tui.zig");
const command = @import("command.zig");
@ -31,6 +32,7 @@ last_match_text: ?[]const u8 = null,
logview_enabled: bool = false,
location_history: location_history,
project_manager: project_manager,
const NavState = struct {
time: i64 = 0,
@ -42,6 +44,12 @@ const NavState = struct {
};
pub fn create(a: std.mem.Allocator, n: nc.Plane) !Widget {
const project_manager_ = try project_manager.create(a);
tp.env.get().proc_set("project", project_manager_.pid.?.ref());
var project_name_buf: [std.fs.MAX_PATH_BYTES]u8 = undefined;
const project_name = std.fs.cwd().realpath(".", &project_name_buf) catch "(none)";
tp.env.get().str_set("project", project_name);
// try project_manager_.open(project_name);
const self = try a.create(Self);
self.* = .{
.a = a,
@ -51,6 +59,7 @@ pub fn create(a: std.mem.Allocator, n: nc.Plane) !Widget {
.floating_views = WidgetStack.init(a),
.statusbar = undefined,
.location_history = try location_history.create(),
.project_manager = project_manager_,
};
try self.commands.init(self);
const w = Widget.to(self);