diff options
author | Shubham Sandeep Rastogi <srastogi22@apple.com> | 2024-02-19 18:19:36 -0800 |
---|---|---|
committer | Shubham Sandeep Rastogi <srastogi22@apple.com> | 2024-02-19 18:19:59 -0800 |
commit | 9ed8b272c30a01c450616f0ed8b2373d5d618ebb (patch) | |
tree | 767aa897f69692523a196a128d954ba408482708 /lldb/source/Commands/CommandObjectPlatform.cpp | |
parent | 744616b3aebd008a5ad0e9de9f82f5e284440ab1 (diff) | |
download | llvm-9ed8b272c30a01c450616f0ed8b2373d5d618ebb.zip llvm-9ed8b272c30a01c450616f0ed8b2373d5d618ebb.tar.gz llvm-9ed8b272c30a01c450616f0ed8b2373d5d618ebb.tar.bz2 |
Revert "Centralize the handling of completion for simple argument lists. (#82085)"
This reverts commit 21631494b068d9364b8dc8f18e59adee9131a0a5.
Reverted because of greendragon failure:
******************** TEST 'lldb-api :: functionalities/completion/TestCompletion.py' FAILED ********************
Script:
Diffstat (limited to 'lldb/source/Commands/CommandObjectPlatform.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectPlatform.cpp | 75 |
1 files changed, 57 insertions, 18 deletions
diff --git a/lldb/source/Commands/CommandObjectPlatform.cpp b/lldb/source/Commands/CommandObjectPlatform.cpp index b25c391..790f1db 100644 --- a/lldb/source/Commands/CommandObjectPlatform.cpp +++ b/lldb/source/Commands/CommandObjectPlatform.cpp @@ -418,7 +418,7 @@ public: : CommandObjectParsed(interpreter, "platform mkdir", "Make a new directory on the remote end.", nullptr, 0) { - CommandArgumentData thread_arg{eArgTypeRemotePath, eArgRepeatPlain}; + CommandArgumentData thread_arg{eArgTypePath, eArgRepeatPlain}; m_arguments.push_back({thread_arg}); } @@ -467,12 +467,21 @@ public: CommandObjectPlatformFOpen(CommandInterpreter &interpreter) : CommandObjectParsed(interpreter, "platform file open", "Open a file on the remote end.", nullptr, 0) { - CommandArgumentData path_arg{eArgTypeRemotePath, eArgRepeatPlain}; + CommandArgumentData path_arg{eArgTypePath, eArgRepeatPlain}; m_arguments.push_back({path_arg}); } ~CommandObjectPlatformFOpen() override = default; + void + HandleArgumentCompletion(CompletionRequest &request, + OptionElementVector &opt_element_vector) override { + if (request.GetCursorIndex() == 0) + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eRemoteDiskFileCompletion, request, + nullptr); + } + void DoExecute(Args &args, CommandReturnObject &result) override { PlatformSP platform_sp( GetDebugger().GetPlatformList().GetSelectedPlatform()); @@ -786,7 +795,7 @@ public: CommandArgumentData file_arg_remote, file_arg_host; // Define the first (and only) variant of this arg. - file_arg_remote.arg_type = eArgTypeRemoteFilename; + file_arg_remote.arg_type = eArgTypeFilename; file_arg_remote.arg_repetition = eArgRepeatPlain; // There is only one variant this argument could be; put it into the // argument entry. @@ -867,7 +876,7 @@ public: CommandArgumentData file_arg_remote; // Define the first (and only) variant of this arg. - file_arg_remote.arg_type = eArgTypeRemoteFilename; + file_arg_remote.arg_type = eArgTypeFilename; file_arg_remote.arg_repetition = eArgRepeatPlain; // There is only one variant this argument could be; put it into the // argument entry. @@ -879,6 +888,17 @@ public: ~CommandObjectPlatformGetSize() override = default; + void + HandleArgumentCompletion(CompletionRequest &request, + OptionElementVector &opt_element_vector) override { + if (request.GetCursorIndex() != 0) + return; + + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eRemoteDiskFileCompletion, request, + nullptr); + } + void DoExecute(Args &args, CommandReturnObject &result) override { // If the number of arguments is incorrect, issue an error message. if (args.GetArgumentCount() != 1) { @@ -926,7 +946,7 @@ public: CommandArgumentData file_arg_remote; // Define the first (and only) variant of this arg. - file_arg_remote.arg_type = eArgTypeRemoteFilename; + file_arg_remote.arg_type = eArgTypeFilename; file_arg_remote.arg_repetition = eArgRepeatPlain; // There is only one variant this argument could be; put it into the // argument entry. @@ -938,6 +958,17 @@ public: ~CommandObjectPlatformGetPermissions() override = default; + void + HandleArgumentCompletion(CompletionRequest &request, + OptionElementVector &opt_element_vector) override { + if (request.GetCursorIndex() != 0) + return; + + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eRemoteDiskFileCompletion, request, + nullptr); + } + void DoExecute(Args &args, CommandReturnObject &result) override { // If the number of arguments is incorrect, issue an error message. if (args.GetArgumentCount() != 1) { @@ -984,7 +1015,7 @@ public: CommandArgumentData file_arg_remote; // Define the first (and only) variant of this arg. - file_arg_remote.arg_type = eArgTypeRemoteFilename; + file_arg_remote.arg_type = eArgTypeFilename; file_arg_remote.arg_repetition = eArgRepeatPlain; // There is only one variant this argument could be; put it into the // argument entry. @@ -996,6 +1027,17 @@ public: ~CommandObjectPlatformFileExists() override = default; + void + HandleArgumentCompletion(CompletionRequest &request, + OptionElementVector &opt_element_vector) override { + if (request.GetCursorIndex() != 0) + return; + + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eRemoteDiskFileCompletion, request, + nullptr); + } + void DoExecute(Args &args, CommandReturnObject &result) override { // If the number of arguments is incorrect, issue an error message. if (args.GetArgumentCount() != 1) { @@ -1038,7 +1080,7 @@ public: Omitting the destination places the file in the platform working directory.)"); CommandArgumentData source_arg{eArgTypePath, eArgRepeatPlain}; - CommandArgumentData path_arg{eArgTypeRemotePath, eArgRepeatOptional}; + CommandArgumentData path_arg{eArgTypePath, eArgRepeatOptional}; m_arguments.push_back({source_arg}); m_arguments.push_back({path_arg}); } @@ -1097,16 +1139,6 @@ public: m_arguments.push_back({run_arg_arg}); } - void - HandleArgumentCompletion(CompletionRequest &request, - OptionElementVector &opt_element_vector) override { - // I didn't make a type for RemoteRunArgs, but since we're going to run - // this on the remote system we should use the remote completer. - lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), lldb::eRemoteDiskFileCompletion, request, - nullptr); - } - ~CommandObjectPlatformProcessLaunch() override = default; Options *GetOptions() override { return &m_all_options; } @@ -1520,6 +1552,13 @@ public: ~CommandObjectPlatformProcessInfo() override = default; + void + HandleArgumentCompletion(CompletionRequest &request, + OptionElementVector &opt_element_vector) override { + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eProcessIDCompletion, request, nullptr); + } + protected: void DoExecute(Args &args, CommandReturnObject &result) override { Target *target = GetDebugger().GetSelectedTarget().get(); @@ -1811,7 +1850,7 @@ public: "Install a target (bundle or executable file) to the remote end.", "platform target-install <local-thing> <remote-sandbox>", 0) { CommandArgumentData local_arg{eArgTypePath, eArgRepeatPlain}; - CommandArgumentData remote_arg{eArgTypeRemotePath, eArgRepeatPlain}; + CommandArgumentData remote_arg{eArgTypePath, eArgRepeatPlain}; m_arguments.push_back({local_arg}); m_arguments.push_back({remote_arg}); } |