aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGongyu Deng <gy_deng@icloud.com>2020-08-11 09:50:28 +0200
committerRaphael Isemann <teemperor@gmail.com>2020-08-11 09:51:55 +0200
commit2e653327e364aae564209af99d3b6a4625e25b68 (patch)
tree756481c1653ee1a67c9bfa2a72ce867f9b27a23f
parentc6d2078a35d536c8fa152fa9205924f8f10cbaac (diff)
downloadllvm-2e653327e364aae564209af99d3b6a4625e25b68.zip
llvm-2e653327e364aae564209af99d3b6a4625e25b68.tar.gz
llvm-2e653327e364aae564209af99d3b6a4625e25b68.tar.bz2
[lldb] tab completion for `watchpoint set variable`
1. Applied the common completion `eVariablePathCompletion` to command `watchpoint set variable`; 2. Added a related test case. Reviewed By: teemperor, JDevlieghere Differential Revision: https://reviews.llvm.org/D84177
-rw-r--r--lldb/source/Commands/CommandObjectWatchpoint.cpp10
-rw-r--r--lldb/test/API/functionalities/completion/TestCompletion.py7
2 files changed, 17 insertions, 0 deletions
diff --git a/lldb/source/Commands/CommandObjectWatchpoint.cpp b/lldb/source/Commands/CommandObjectWatchpoint.cpp
index c2a008a..390e241 100644
--- a/lldb/source/Commands/CommandObjectWatchpoint.cpp
+++ b/lldb/source/Commands/CommandObjectWatchpoint.cpp
@@ -823,6 +823,16 @@ corresponding to the byte size of the data type.");
~CommandObjectWatchpointSetVariable() override = default;
+ void
+ HandleArgumentCompletion(CompletionRequest &request,
+ OptionElementVector &opt_element_vector) override {
+ if (request.GetCursorIndex() != 0)
+ return;
+ CommandCompletions::InvokeCommonCompletionCallbacks(
+ GetCommandInterpreter(), CommandCompletions::eVariablePathCompletion,
+ request, nullptr);
+ }
+
Options *GetOptions() override { return &m_option_group; }
protected:
diff --git a/lldb/test/API/functionalities/completion/TestCompletion.py b/lldb/test/API/functionalities/completion/TestCompletion.py
index da66f89..a57dbdb 100644
--- a/lldb/test/API/functionalities/completion/TestCompletion.py
+++ b/lldb/test/API/functionalities/completion/TestCompletion.py
@@ -209,6 +209,13 @@ class CommandLineCompletionTestCase(TestBase):
"""Test that 'watchpoint set var' completes to 'watchpoint set variable '."""
self.complete_from_to('watchpoint set var', 'watchpoint set variable ')
+ def test_watchpoint_set_variable_foo(self):
+ self.build()
+ lldbutil.run_to_source_breakpoint(self, '// Break here', lldb.SBFileSpec("main.cpp"))
+ self.complete_from_to('watchpoint set variable fo', 'watchpoint set variable fooo')
+ # Only complete the first argument.
+ self.complete_from_to('watchpoint set variable fooo ', 'watchpoint set variable fooo ')
+
def test_help_fi(self):
"""Test that 'help fi' completes to ['file', 'finish']."""
self.complete_from_to(