[Lldb-commits] [lldb] [lldb-dap] Migrating 'completions' to structured types. (PR #153317)
Ebuka Ezike via lldb-commits
lldb-commits at lists.llvm.org
Thu Aug 21 10:26:03 PDT 2025
================
@@ -198,27 +85,25 @@ void CompletionsRequestHandler::operator()(
std::string match = matches.GetStringAtIndex(i);
std::string description = descriptions.GetStringAtIndex(i);
- llvm::json::Object item;
- llvm::StringRef match_ref = match;
- for (llvm::StringRef commit_point : {".", "->"}) {
+ CompletionItem item;
+ StringRef match_ref = match;
+ for (StringRef commit_point : {".", "->"}) {
if (match_ref.contains(commit_point)) {
match_ref = match_ref.rsplit(commit_point).second;
}
}
- EmplaceSafeString(item, "text", match_ref);
+ item.text = match_ref;
if (description.empty())
- EmplaceSafeString(item, "label", match);
+ item.label = match;
else
- EmplaceSafeString(item, "label", match + " -- " + description);
+ item.label = match + " -- " + description;
targets.emplace_back(std::move(item));
}
}
- body.try_emplace("targets", std::move(targets));
- response.try_emplace("body", std::move(body));
- dap.SendJSON(llvm::json::Value(std::move(response)));
+ return CompletionsResponseBody{targets};
----------------
da-viper wrote:
```suggestion
return CompletionsResponseBody{std::move(targets)};
```
https://github.com/llvm/llvm-project/pull/153317
More information about the lldb-commits
mailing list