feat(daemon,registry): filter watch events by prefix; answer OPTIONS
VoidBuildSystem CI / build-and-test-gcc16 (push) Failing after 4s
VoidBuildSystem CI / signing-openssl-gcc16 (push) Failing after 7s

This commit is contained in:
faumaray committed 2026-12-04 06:30:05 +03:00
1 parent e7698a411d
commit e61eff7a8f
9 files changed
+208 -11

No files matched your search

+16 -4
View File
@@ -1747,7 +1747,11 @@ int execute_daemon_command(std::string_view sub, const DaemonCmdOptions &opts) {
? std::format(",\"file\":{}", Util::json_quote(*opts.file_filter_arg))
: std::string{});
} else if (sub == "watch_poll") {
request_json = R"({"op":"watch_poll"})";
request_json =
opts.prefix_arg
? std::format(R"({{"op":"watch_poll","prefix":{}}})",
Util::json_quote(*opts.prefix_arg))
: std::string{R"({"op":"watch_poll"})"};
} else if (sub == "watch_wait") {
std::int64_t timeout_ms = 0;
const auto [ptr, ec] =
@@ -1759,7 +1763,10 @@ int execute_daemon_command(std::string_view sub, const DaemonCmdOptions &opts) {
<< "' (0..5000)\n";
return 2;
}
request_json = std::format(R"({{"op":"watch_wait","timeout_ms":{}}})", timeout_ms);
request_json = std::format(
R"({{"op":"watch_wait","timeout_ms":{}{}}})", timeout_ms,
opts.prefix_arg ? std::format(",\"prefix\":{}", Util::json_quote(*opts.prefix_arg))
: std::string{});
} else if (sub == "ide_generate") {
if (opts.profile_arg.empty()) {
std::cerr << "vbs daemon ide generate: --profile must not be empty\n";
@@ -2863,11 +2870,16 @@ int main(int argc, char **argv) {
auto &daemon_ide_poll_cmd = daemon_ide_cmd.subcommand(
"poll", "Poll pending project file changes (editor extension protocol)");
configure_daemon_common(daemon_ide_poll_cmd);
daemon_ide_poll_cmd.option("--prefix", "", "Only report changed paths under this prefix",
daemon_opts.prefix_arg);
auto &daemon_ide_wait_cmd = daemon_ide_cmd.subcommand(
"wait", "Long-poll for project file changes (bounded, editor extension protocol)");
configure_daemon_common(daemon_ide_wait_cmd);
daemon_ide_wait_cmd.option_default("--timeout-ms", "", "Maximum wait in milliseconds (0..5000)",
daemon_opts.timeout_ms_arg, "2000");
daemon_ide_wait_cmd
.option_default("--timeout-ms", "", "Maximum wait in milliseconds (0..5000)",
daemon_opts.timeout_ms_arg, "2000")
.option("--prefix", "", "Only report changed paths under this prefix",
daemon_opts.prefix_arg);
auto &daemon_ide_generate_cmd =
daemon_ide_cmd.subcommand("generate", "Write editor configuration files");
configure_daemon_common(daemon_ide_generate_cmd);