[Lldb-commits] [PATCH] D71824: Add the 'start' and 'length' to the completions response. This will fix an issue where applying a completion 'foo.bar' to 'po foo.b' inserts the entire completion resulting in 'po foo.foo.bar'.
Ivan Hernandez via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Sun Dec 22 18:59:13 PST 2019
ivanhernandez13 created this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D71824
Files:
lldb/tools/lldb-vscode/lldb-vscode.cpp
Index: lldb/tools/lldb-vscode/lldb-vscode.cpp
===================================================================
--- lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -947,6 +947,7 @@
0, -1, matches, descriptions);
size_t count = std::min((uint32_t)50, matches.GetSize());
targets.reserve(count);
+ auto command_prefix = llvm::StringRef(text).rsplit(" ").second;
for (size_t i = 0; i < count; i++) {
std::string match = matches.GetStringAtIndex(i);
std::string description = descriptions.GetStringAtIndex(i);
@@ -958,6 +959,15 @@
else
EmplaceSafeString(item, "label", match + " -- " + description);
+ auto command_prefix_size = command_prefix.size();
+ if (command_prefix_size && match.find(command_prefix, 0) == 0) {
+ EmplaceSafeString(item, "start",
+ llvm::StringRef(std::to_string(actual_column -
+ command_prefix_size)));
+ EmplaceSafeString(item, "length",
+ llvm::StringRef(std::to_string(command_prefix_size)));
+ }
+
targets.emplace_back(std::move(item));
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71824.235087.patch
Type: text/x-patch
Size: 1172 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20191223/929a3653/attachment-0001.bin>
More information about the lldb-commits
mailing list