Index: lldb/include/lldb/Interpreter/CommandInterpreter.h =================================================================== --- lldb/include/lldb/Interpreter/CommandInterpreter.h +++ lldb/include/lldb/Interpreter/CommandInterpreter.h @@ -494,6 +494,10 @@ bool GetEchoCommentCommands() const; void SetEchoCommentCommands(bool enable); + const CommandObject::CommandMap &GetUserCommands() const { + return m_user_dict; + } + /// Specify if the command interpreter should allow that the user can /// specify a custom exit code when calling 'quit'. void AllowExitCodeOnQuit(bool allow); Index: lldb/source/Commands/CommandObjectCommands.cpp =================================================================== --- lldb/source/Commands/CommandObjectCommands.cpp +++ lldb/source/Commands/CommandObjectCommands.cpp @@ -1767,6 +1767,19 @@ ~CommandObjectCommandsScriptDelete() override = default; + void + HandleArgumentCompletion(CompletionRequest &request, + OptionElementVector &opt_element_vector) override { + + if (!m_interpreter.HasCommands() || request.GetCursorIndex() != 0) + return; + const auto &user_dict = m_interpreter.GetUserCommands(); + + for (auto pos = user_dict.begin(); pos != user_dict.end(); ++pos) { + request.TryCompleteCurrentArg(pos->first, pos->second->GetHelp()); + } + } + protected: bool DoExecute(Args &command, CommandReturnObject &result) override { Index: lldb/test/API/functionalities/completion/TestCompletion.py =================================================================== --- lldb/test/API/functionalities/completion/TestCompletion.py +++ lldb/test/API/functionalities/completion/TestCompletion.py @@ -371,6 +371,10 @@ self.complete_from_to("watchpoint set variable foo --watch w", "watchpoint set variable foo --watch write") self.complete_from_to('watchpoint set variable foo -w read_', 'watchpoint set variable foo -w read_write') + def test_command_script_delete(self): + self.runCmd("command script add -h test_desc -f none -s current usercmd1") + self.check_completion_with_desc('command script delete ', [['usercmd1', 'test_desc']]) + def test_completion_description_commands(self): """Test descriptions of top-level command completions""" self.check_completion_with_desc("", [