diff --git a/lldb/source/Commands/CommandObjectWatchpoint.cpp b/lldb/source/Commands/CommandObjectWatchpoint.cpp --- a/lldb/source/Commands/CommandObjectWatchpoint.cpp +++ b/lldb/source/Commands/CommandObjectWatchpoint.cpp @@ -823,6 +823,16 @@ ~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 --- a/lldb/test/API/functionalities/completion/TestCompletion.py +++ b/lldb/test/API/functionalities/completion/TestCompletion.py @@ -209,6 +209,13 @@ """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(