feat(daemon): support member-scoped IDE requests for workspaces
VoidBuildSystem CI / build-and-test-gcc16 (push) Failing after 3s
VoidBuildSystem CI / signing-openssl-gcc16 (push) Failing after 19s

This commit is contained in:
faumaray committed 2026-12-03 21:29:26 +03:00
1 parent d6bbd95ced
commit 359783d2ad
8 files changed
+149 -65

No files matched your search

+25 -12
View File
@@ -1469,6 +1469,7 @@ struct DaemonCmdOptions {
std::vector<std::string> targets;
std::string jobs_arg{"0"};
std::string editor_arg{"all"};
std::optional<std::string> member_arg;
std::string timeout_ms_arg{"2000"};
bool force{false};
std::string max_bytes_arg{"0"};
@@ -1569,24 +1570,30 @@ int execute_daemon_command(std::string_view sub, const DaemonCmdOptions &opts) {
std::cerr << "vbs daemon ide generate: --profile must not be empty\n";
return 2;
}
request_json =
std::format(R"({{"op":"ide_generate","profile":{},"editor":{},"force":{}}})",
Util::json_quote(opts.profile_arg), Util::json_quote(opts.editor_arg),
opts.force ? "true" : "false");
request_json = std::format(
R"({{"op":"ide_generate","profile":{},"editor":{},"force":{}{}}})",
Util::json_quote(opts.profile_arg), Util::json_quote(opts.editor_arg),
opts.force ? "true" : "false",
opts.member_arg ? std::format(",\"member\":{}", Util::json_quote(*opts.member_arg))
: std::string{});
} else if (sub == "compdb_export") {
if (opts.profile_arg.empty()) {
std::cerr << "vbs daemon compdb export: --profile must not be empty\n";
return 2;
}
request_json = std::format(R"({{"op":"compdb_export","profile":{}}})",
Util::json_quote(opts.profile_arg));
request_json = std::format(
R"({{"op":"compdb_export","profile":{}{}}})", Util::json_quote(opts.profile_arg),
opts.member_arg ? std::format(",\"member\":{}", Util::json_quote(*opts.member_arg))
: std::string{});
} else if (sub == "ide_query") {
if (opts.profile_arg.empty()) {
std::cerr << "vbs daemon ide query: --profile must not be empty\n";
return 2;
}
request_json =
std::format(R"({{"op":"ide_query","profile":{}}})", Util::json_quote(opts.profile_arg));
request_json = std::format(
R"({{"op":"ide_query","profile":{}{}}})", Util::json_quote(opts.profile_arg),
opts.member_arg ? std::format(",\"member\":{}", Util::json_quote(*opts.member_arg))
: std::string{});
} else if (sub == "build") {
std::size_t jobs = 0;
const auto [ptr, ec] = std::from_chars(opts.jobs_arg.data(),
@@ -2601,15 +2608,19 @@ int main(int argc, char **argv) {
auto &daemon_compdb_export_cmd =
daemon_compdb_cmd.subcommand("export", "Publish the profile compilation database");
configure_daemon_common(daemon_compdb_export_cmd);
daemon_compdb_export_cmd.option_default("--profile", "-p", "Profile to export",
daemon_opts.profile_arg, "debug");
daemon_compdb_export_cmd
.option_default("--profile", "-p", "Profile to export", daemon_opts.profile_arg, "debug")
.option("--member", "", "Workspace member (required for workspace roots)",
daemon_opts.member_arg);
auto &daemon_ide_cmd = daemon_cmd.subcommand("ide", "Editor/IDE metadata served by the daemon");
configure_daemon_common(daemon_ide_cmd);
auto &daemon_ide_query_cmd =
daemon_ide_cmd.subcommand("query", "Emit IDE workspace/target/compdb metadata JSON");
configure_daemon_common(daemon_ide_query_cmd);
daemon_ide_query_cmd.option_default("--profile", "-p", "Profile to query",
daemon_opts.profile_arg, "debug");
daemon_ide_query_cmd
.option_default("--profile", "-p", "Profile to query", daemon_opts.profile_arg, "debug")
.option("--member", "", "Workspace member (required for workspace roots)",
daemon_opts.member_arg);
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);
@@ -2625,6 +2636,8 @@ int main(int argc, char **argv) {
.option_default("--profile", "-p", "Profile to evaluate", daemon_opts.profile_arg, "debug")
.option_default("--editor", "-e", "Editor preset (all|clangd|vscode|clion|zed)",
daemon_opts.editor_arg, "all")
.option("--member", "", "Workspace member (required for workspace roots)",
daemon_opts.member_arg)
.flag("--force", "", "Overwrite existing IDE configuration files", daemon_opts.force);
const auto parsed = root.parse_detailed(argc, argv);