[Lldb-commits] [PATCH] D73506: Auto-completion bug fix for dot operator
Pavel Labath via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Tue Jan 28 00:34:16 PST 2020
labath added a comment.
Thanks for the patch.
I don't know much about the LSP protocol, but I see opportunities for simplifying the string chopping code. See the inline comment for what /I think/ should be the equivalent code.
It has also occurred to me that this may break for expressions containing quoted dots (`foo(".", b<TAB>`), but I don't know if there's anything we can do about that...
================
Comment at: lldb/tools/lldb-vscode/lldb-vscode.cpp:957-973
+ std::vector<std::string> commit_points = {".", "->"};
+ int max_breakpoint_position = -1;
+ int commit_points_index = -1;
+ for (size_t breakpoint_index = 0; breakpoint_index < commit_points.size(); breakpoint_index++) {
+ int breakpoint_position = match.rfind(commit_points[breakpoint_index]);
+ if (max_breakpoint_position < breakpoint_position){
+ commit_points_index = breakpoint_index;
----------------
If I correctly understand what this is doing, all of this should boil down to something like:
```
llvm::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);
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D73506/new/
https://reviews.llvm.org/D73506
More information about the lldb-commits
mailing list