[Lldb-commits] [lldb] [lldb] returning command completions up to a maximum (PR #135565)
Jacob Lalonde via lldb-commits
lldb-commits at lists.llvm.org
Thu Apr 17 11:38:59 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 not been reached
+ /// yet, hence we should keep adding completions.
+ bool ShouldAddCompletions() const {
+ return m_result.GetNumberOfResults() < m_max_return_elements;
+ }
+
+ /// Returns the maximum number of completions that need to be added
+ /// until reaching the maximum
+ size_t GetMaxNumberOfResultsToAdd() const {
+ const size_t number_of_results = m_result.GetNumberOfResults();
+ if (number_of_results >= m_max_return_elements)
----------------
Jlalond wrote:
Shouldn't this just call `ShouldAddCompletions()` and return 0 if false?
https://github.com/llvm/llvm-project/pull/135565
More information about the lldb-commits
mailing list