[Lldb-commits] [lldb] [lldb] returning command completions up to a maximum (PR #135565)

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Mon Apr 14 01:08:03 PDT 2025


================
@@ -157,6 +162,23 @@ class CompletionRequest {
 
   size_t GetCursorIndex() const { return m_cursor_index; }
 
+  size_t GetMaxReturnElements() const { return m_max_return_elements; }
+
+  /// Returns true if the maximum number of completions has been reached
+  /// already.
+  bool ShouldStopAddingResults() const {
+    return m_result.GetNumberOfResults() >= m_max_return_elements;
+  }
----------------
JDevlieghere wrote:

I would consider inverting this to avoid the double negation in the for-loop.
```suggestion
  bool ShouldAddResult() const {
    return m_result.GetNumberOfResults() < m_max_return_elements;
  }
```

https://github.com/llvm/llvm-project/pull/135565


More information about the lldb-commits mailing list