summaryrefslogtreecommitdiff
path: root/src/detached
diff options
context:
space:
mode:
Diffstat (limited to 'src/detached')
-rw-r--r--src/detached/server.zig10
-rw-r--r--src/detached/wire.zig6
2 files changed, 13 insertions, 3 deletions
diff --git a/src/detached/server.zig b/src/detached/server.zig
index 124a4c5a..eefce93e 100644
--- a/src/detached/server.zig
+++ b/src/detached/server.zig
@@ -166,6 +166,8 @@ pub const Session = struct {
s.inbox.lsp_task = null;
}
s.pipe_tasks.cancelAll(s.io);
+ // Its worker may be waiting on the inbox for room.
+ s.core.stream.cancelTask();
_ = s.drainCompletions(false);
}
@@ -197,6 +199,7 @@ pub const Session = struct {
var buf: [256]u8 = undefined;
s.core.setStatus(s.core.active, message.stamp(&buf, "lsp", status));
},
+ .search => |b| s.core.update(.{ .search = b }),
// Ptys are read in the loop's own poll, not through the inbox.
.output, .eof, .files_changed, .fs_ready => {},
}
@@ -350,8 +353,15 @@ pub const Session = struct {
.detach = detach,
.lsp = lspRequest,
.pipe = pipeRequest,
+ .search = searchRequest,
};
+ fn searchRequest(ctx: ?*anyopaque, gen: u32) void {
+ const s = of(ctx);
+ if (s.wake[0] < 0) return pardes.Stream.runHere(s.core, gen);
+ pardes.Stream.start(s.io, s.worker_gpa, s.core, gen, &s.inbox, host_io.Inbox.pushSearch);
+ }
+
fn lspRequest(ctx: ?*anyopaque, request: host_io.Lsp.Request) void {
const s = of(ctx);
_ = s.drainCompletions(true);
diff --git a/src/detached/wire.zig b/src/detached/wire.zig
index 2318d319..82614b4f 100644
--- a/src/detached/wire.zig
+++ b/src/detached/wire.zig
@@ -856,7 +856,7 @@ fn clientTag(msg: ClientMsg) ClientTag {
return switch (msg) {
.event => |ev| switch (ev) {
// Machine-local reports and 9P requests belong to the session owner.
- .output, .eof, .exited, .lsp_resp, .pipe_resp, .file_changed, .tick => unreachable,
+ .output, .eof, .exited, .lsp_resp, .pipe_resp, .search, .file_changed, .tick => unreachable,
inline else => |_, t| @field(ClientTag, @tagName(t)),
},
inline else => |_, t| @field(ClientTag, @tagName(t)),
@@ -986,7 +986,7 @@ pub fn encodeClient(out: []u8, msg: ClientMsg) Error![]const u8 {
.pointer_leave => {},
.focus => |focused| try w.writeByte(@intFromBool(focused)),
// See `clientTag`: no tag, so nothing to encode.
- .output, .eof, .exited, .lsp_resp, .pipe_resp, .file_changed, .tick => unreachable,
+ .output, .eof, .exited, .lsp_resp, .pipe_resp, .search, .file_changed, .tick => unreachable,
},
}
try finishMessage(&w, at);
@@ -1137,7 +1137,7 @@ pub fn clientBound(msg: ClientMsg) usize {
.paste => |b| b.len,
.command => |line| line.len,
// See `clientTag`: not on this wire in this direction.
- .output, .eof, .exited, .lsp_resp, .pipe_resp, .file_changed, .tick => unreachable,
+ .output, .eof, .exited, .lsp_resp, .pipe_resp, .search, .file_changed, .tick => unreachable,
},
};
}