================
@@ -311,10 +309,22 @@ void DAP::SendOutput(OutputType o, const llvm::StringRef
output) {
category = "telemetry";
break;
}
- body.try_emplace("category", category);
- EmplaceSafeString(body, "output", output.str());
- event.try_emplace("body", std::move(body));
- SendJSON(llvm::json::Value(std::move(event)));
+
+ // Send each line of output as an individual event, including the newline if
+ // present.
+ ::size_t idx = 0;
+ do {
+ ::size_t end = output.find('\n', idx);
+ if (end == llvm::StringRef::npos)
+ end = output.size() - 1;
+ llvm::json::Object event(CreateEventObject("output"));
+ llvm::json::Object body;
+ body.try_emplace("category", category);
+ EmplaceSafeString(body, "output", output.slice(idx, end + 1).str());
+ event.try_emplace("body", std::move(body));
+ SendJSON(llvm::json::Value(std::move(event)));
+ idx = end + 1;
+ } while (idx < output.size());
----------------
vogelsgesang wrote:
afaict, we still send partial lines without a `\n` in the end as individual
output events. Should we instead only send full lines as output events?
https://github.com/llvm/llvm-project/pull/105456
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits