diff options
Diffstat (limited to 'lldb/source/Commands/CommandObjectTarget.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectTarget.cpp | 117 |
1 files changed, 61 insertions, 56 deletions
diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp index feeecf5517c..fc25fb37d4d 100644 --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -195,20 +195,21 @@ public: Options *GetOptions() override { return &m_option_group; } - int HandleArgumentCompletion(Args &input, int &cursor_index, - int &cursor_char_position, - OptionElementVector &opt_element_vector, - int match_start_point, int max_return_elements, - bool &word_complete, - StringList &matches) override { - std::string completion_str(input.GetArgumentAtIndex(cursor_index)); - completion_str.erase(cursor_char_position); - + int HandleArgumentCompletion( + CompletionRequest &request, + OptionElementVector &opt_element_vector) override { + std::string completion_str( + request.GetParsedLine().GetArgumentAtIndex(request.GetCursorIndex())); + completion_str.erase(request.GetCursorCharPosition()); + + bool word_complete = request.GetWordComplete(); CommandCompletions::InvokeCommonCompletionCallbacks( GetCommandInterpreter(), CommandCompletions::eDiskFileCompletion, - completion_str.c_str(), match_start_point, max_return_elements, nullptr, - word_complete, matches); - return matches.GetSize(); + completion_str.c_str(), request.GetMatchStartPoint(), + request.GetMaxReturnElements(), nullptr, word_complete, + request.GetMatches()); + request.SetWordComplete(word_complete); + return request.GetMatches().GetSize(); } protected: @@ -1811,21 +1812,22 @@ public: ~CommandObjectTargetModulesModuleAutoComplete() override = default; - int HandleArgumentCompletion(Args &input, int &cursor_index, - int &cursor_char_position, - OptionElementVector &opt_element_vector, - int match_start_point, int max_return_elements, - bool &word_complete, - StringList &matches) override { + int HandleArgumentCompletion( + CompletionRequest &request, + OptionElementVector &opt_element_vector) override { // Arguments are the standard module completer. - std::string completion_str(input.GetArgumentAtIndex(cursor_index)); - completion_str.erase(cursor_char_position); + std::string completion_str( + request.GetParsedLine().GetArgumentAtIndex(request.GetCursorIndex())); + completion_str.erase(request.GetCursorCharPosition()); + bool word_complete = request.GetWordComplete(); CommandCompletions::InvokeCommonCompletionCallbacks( GetCommandInterpreter(), CommandCompletions::eModuleCompletion, - completion_str.c_str(), match_start_point, max_return_elements, nullptr, - word_complete, matches); - return matches.GetSize(); + completion_str.c_str(), request.GetMatchStartPoint(), + request.GetMaxReturnElements(), nullptr, word_complete, + request.GetMatches()); + request.SetWordComplete(word_complete); + return request.GetMatches().GetSize(); } }; @@ -1860,21 +1862,22 @@ public: ~CommandObjectTargetModulesSourceFileAutoComplete() override = default; - int HandleArgumentCompletion(Args &input, int &cursor_index, - int &cursor_char_position, - OptionElementVector &opt_element_vector, - int match_start_point, int max_return_elements, - bool &word_complete, - StringList &matches) override { + int HandleArgumentCompletion( + CompletionRequest &request, + OptionElementVector &opt_element_vector) override { // Arguments are the standard source file completer. - std::string completion_str(input.GetArgumentAtIndex(cursor_index)); - completion_str.erase(cursor_char_position); + std::string completion_str( + request.GetParsedLine().GetArgumentAtIndex(request.GetCursorIndex())); + completion_str.erase(request.GetCursorCharPosition()); + bool word_complete = request.GetWordComplete(); CommandCompletions::InvokeCommonCompletionCallbacks( GetCommandInterpreter(), CommandCompletions::eSourceFileCompletion, - completion_str.c_str(), match_start_point, max_return_elements, nullptr, - word_complete, matches); - return matches.GetSize(); + completion_str.c_str(), request.GetMatchStartPoint(), + request.GetMaxReturnElements(), nullptr, word_complete, + request.GetMatches()); + request.SetWordComplete(word_complete); + return request.GetMatches().GetSize(); } }; @@ -2410,20 +2413,21 @@ public: Options *GetOptions() override { return &m_option_group; } - int HandleArgumentCompletion(Args &input, int &cursor_index, - int &cursor_char_position, - OptionElementVector &opt_element_vector, - int match_start_point, int max_return_elements, - bool &word_complete, - StringList &matches) override { - std::string completion_str(input.GetArgumentAtIndex(cursor_index)); - completion_str.erase(cursor_char_position); + int HandleArgumentCompletion( + CompletionRequest &request, + OptionElementVector &opt_element_vector) override { + std::string completion_str( + request.GetParsedLine().GetArgumentAtIndex(request.GetCursorIndex())); + completion_str.erase(request.GetCursorCharPosition()); + bool word_complete = request.GetWordComplete(); CommandCompletions::InvokeCommonCompletionCallbacks( GetCommandInterpreter(), CommandCompletions::eDiskFileCompletion, - completion_str.c_str(), match_start_point, max_return_elements, nullptr, - word_complete, matches); - return matches.GetSize(); + completion_str.c_str(), request.GetMatchStartPoint(), + request.GetMaxReturnElements(), nullptr, word_complete, + request.GetMatches()); + request.SetWordComplete(word_complete); + return request.GetMatches().GetSize(); } protected: @@ -4011,20 +4015,21 @@ public: ~CommandObjectTargetSymbolsAdd() override = default; - int HandleArgumentCompletion(Args &input, int &cursor_index, - int &cursor_char_position, - OptionElementVector &opt_element_vector, - int match_start_point, int max_return_elements, - bool &word_complete, - StringList &matches) override { - std::string completion_str(input.GetArgumentAtIndex(cursor_index)); - completion_str.erase(cursor_char_position); + int HandleArgumentCompletion( + CompletionRequest &request, + OptionElementVector &opt_element_vector) override { + std::string completion_str( + request.GetParsedLine().GetArgumentAtIndex(request.GetCursorIndex())); + completion_str.erase(request.GetCursorCharPosition()); + bool word_complete = request.GetWordComplete(); CommandCompletions::InvokeCommonCompletionCallbacks( GetCommandInterpreter(), CommandCompletions::eDiskFileCompletion, - completion_str.c_str(), match_start_point, max_return_elements, nullptr, - word_complete, matches); - return matches.GetSize(); + completion_str.c_str(), request.GetMatchStartPoint(), + request.GetMaxReturnElements(), nullptr, word_complete, + request.GetMatches()); + request.SetWordComplete(word_complete); + return request.GetMatches().GetSize(); } Options *GetOptions() override { return &m_option_group; } |