feat(daemon): report editor selection and compdb status
This commit is contained in:
1 parent
1a884fd931
commit
343e03c27c
9 files changed
+140
-6
No files matched your search
+12
-4
@@ -1551,6 +1551,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 == "editor_status") {
|
||||
request_json = R"({"op":"editor_status"})";
|
||||
} else if (sub == "watch_poll") {
|
||||
request_json = R"({"op":"watch_poll"})";
|
||||
} else if (sub == "watch_wait") {
|
||||
@@ -1618,10 +1620,10 @@ 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 == "watch_poll" ? std::chrono::milliseconds{5000}
|
||||
: sub == "watch_wait" ? std::chrono::milliseconds{10000}
|
||||
: sub == "describe" ? std::chrono::milliseconds{15000}
|
||||
sub == "build" ? std::chrono::milliseconds{std::chrono::hours{1}}
|
||||
: (sub == "watch_poll" || sub == "editor_status") ? std::chrono::milliseconds{5000}
|
||||
: sub == "watch_wait" ? std::chrono::milliseconds{10000}
|
||||
: sub == "describe" ? std::chrono::milliseconds{15000}
|
||||
: (sub == "ide_query" || sub == "ide_generate" || sub == "compdb_export")
|
||||
? std::chrono::milliseconds{30000}
|
||||
: std::chrono::milliseconds{2000};
|
||||
@@ -2621,6 +2623,9 @@ int main(int argc, char **argv) {
|
||||
.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_status_cmd =
|
||||
daemon_ide_cmd.subcommand("status", "Report the active editor selection and compdb state");
|
||||
configure_daemon_common(daemon_ide_status_cmd);
|
||||
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);
|
||||
@@ -2744,6 +2749,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] == "status") {
|
||||
daemon_sub = "editor_status";
|
||||
} else if (daemon_sub == "ide" && parsed.matched_command_path.size() > 2 &&
|
||||
parsed.matched_command_path[2] == "poll") {
|
||||
daemon_sub = "watch_poll";
|
||||
|
||||
Reference in new issue
Block a user