[Lldb-commits] [PATCH] D84177: [lldb] tab completion for `watchpoint set variable`

Raphael Isemann via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Aug 11 00:52:17 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG2e653327e364: [lldb] tab completion for `watchpoint set variable` (authored by MrHate, committed by teemperor).
Herald added a subscriber: lldb-commits.

Changed prior to commit:
  https://reviews.llvm.org/D84177?vs=279260&id=284596#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84177/new/

https://reviews.llvm.org/D84177

Files:
  lldb/source/Commands/CommandObjectWatchpoint.cpp
  lldb/test/API/functionalities/completion/TestCompletion.py


Index: lldb/test/API/functionalities/completion/TestCompletion.py
===================================================================
--- lldb/test/API/functionalities/completion/TestCompletion.py
+++ 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(
Index: lldb/source/Commands/CommandObjectWatchpoint.cpp
===================================================================
--- lldb/source/Commands/CommandObjectWatchpoint.cpp
+++ 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:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84177.284596.patch
Type: text/x-patch
Size: 1746 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200811/d3720eca/attachment.bin>


More information about the lldb-commits mailing list