Skip to content

Commit 49551ed

Browse files
committed
Have Progress message updates include their messages when sent over DAP
1 parent 1888a5f commit 49551ed

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

lldb/tools/lldb-dap/ProgressEvent.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,10 @@ json::Value ProgressEvent::ToJSON() const {
117117
body.try_emplace("cancellable", false);
118118
}
119119

120+
if (m_event_type == progressUpdate) {
121+
EmplaceSafeString(body, "message", m_message);
122+
}
123+
120124
std::string timestamp(llvm::formatv("{0:f9}", m_creation_time.count()));
121125
EmplaceSafeString(body, "timestamp", timestamp);
122126

@@ -164,10 +168,11 @@ const ProgressEvent &ProgressEventManager::GetMostRecentEvent() const {
164168
return m_last_update_event ? *m_last_update_event : m_start_event;
165169
}
166170

167-
void ProgressEventManager::Update(uint64_t progress_id, uint64_t completed,
168-
uint64_t total) {
169-
if (std::optional<ProgressEvent> event = ProgressEvent::Create(
170-
progress_id, std::nullopt, completed, total, &GetMostRecentEvent())) {
171+
void ProgressEventManager::Update(uint64_t progress_id, const char *message,
172+
uint64_t completed, uint64_t total) {
173+
if (std::optional<ProgressEvent> event =
174+
ProgressEvent::Create(progress_id, StringRef(message), completed,
175+
total, &GetMostRecentEvent())) {
171176
if (event->GetEventType() == progressEnd)
172177
m_finished = true;
173178

@@ -227,7 +232,7 @@ void ProgressEventReporter::Push(uint64_t progress_id, const char *message,
227232
m_unreported_start_events.push(event_manager);
228233
}
229234
} else {
230-
it->second->Update(progress_id, completed, total);
235+
it->second->Update(progress_id, message, completed, total);
231236
if (it->second->Finished())
232237
m_event_managers.erase(it);
233238
}

lldb/tools/lldb-dap/ProgressEvent.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ class ProgressEventManager {
9999

100100
/// Receive a new progress event for the start event and try to report it if
101101
/// appropriate.
102-
void Update(uint64_t progress_id, uint64_t completed, uint64_t total);
102+
void Update(uint64_t progress_id, const char *message, uint64_t completed,
103+
uint64_t total);
103104

104105
/// \return
105106
/// \b true if a \a progressEnd event has been notified. There's no

0 commit comments

Comments
 (0)