feat(daemon): add editor-extension watch poll protocol
VoidBuildSystem CI / build-and-test-gcc16 (push) Failing after 7s
VoidBuildSystem CI / signing-openssl-gcc16 (push) Failing after 1m19s

This commit is contained in:
faumaray committed 2026-12-03 20:45:09 +03:00
1 parent e15e2cb2b4
commit c7a6bad3c0
9 files changed
+122 -14

No files matched your search

+11 -2
View File
@@ -1445,6 +1445,8 @@ int execute_daemon_command(std::string_view sub, const DaemonCmdOptions &opts) {
}
request_json =
std::format(R"({{"op":"describe","profile":{}}})", Util::json_quote(opts.profile_arg));
} else if (sub == "watch_poll") {
request_json = R"({"op":"watch_poll"})";
} else if (sub == "ide_generate") {
if (opts.profile_arg.empty()) {
std::cerr << "vbs daemon ide generate: --profile must not be empty\n";
@@ -1492,8 +1494,9 @@ int execute_daemon_command(std::string_view sub, const DaemonCmdOptions &opts) {
// Describe evaluates the whole project graph (descriptor compile, toolchain probe, lowering),
// which can exceed the 2 s default; the daemon bounds evaluation at 10 s.
const auto request_timeout =
sub == "build" ? std::chrono::milliseconds{std::chrono::hours{1}}
: sub == "describe" ? std::chrono::milliseconds{15000}
sub == "build" ? std::chrono::milliseconds{std::chrono::hours{1}}
: sub == "watch_poll" ? std::chrono::milliseconds{5000}
: sub == "describe" ? std::chrono::milliseconds{15000}
: (sub == "ide_query" || sub == "ide_generate" || sub == "compdb_export")
? std::chrono::milliseconds{30000}
: std::chrono::milliseconds{2000};
@@ -2453,6 +2456,9 @@ int main(int argc, char **argv) {
configure_daemon_common(daemon_ide_query_cmd);
daemon_ide_query_cmd.option_default("--profile", "-p", "Profile to query",
daemon_opts.profile_arg, "debug");
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);
auto &daemon_ide_generate_cmd =
daemon_ide_cmd.subcommand("generate", "Write editor configuration files");
configure_daemon_common(daemon_ide_generate_cmd);
@@ -2560,6 +2566,9 @@ int main(int argc, char **argv) {
} else if (daemon_sub == "ide" && parsed.matched_command_path.size() > 2 &&
parsed.matched_command_path[2] == "generate") {
daemon_sub = "ide_generate";
} else if (daemon_sub == "ide" && parsed.matched_command_path.size() > 2 &&
parsed.matched_command_path[2] == "poll") {
daemon_sub = "watch_poll";
} else if (daemon_sub == "compdb" && parsed.matched_command_path.size() > 2 &&
parsed.matched_command_path[2] == "export") {
daemon_sub = "compdb_export";