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)); }
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)); }
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits