LLDB mainline
|
"lldb/Utility/ArgCompletionRequest.h" More...
#include <CompletionRequest.h>
Public Member Functions | |
CompletionRequest (llvm::StringRef command_line, unsigned raw_cursor_pos, CompletionResult &result) | |
Constructs a completion request. | |
void | SetMaxReturnElements (size_t max_return_elements) |
Sets the maximum number of completions that should be returned. | |
llvm::StringRef | GetRawLine () const |
Returns the raw user input used to create this CompletionRequest cut off at the cursor position. | |
llvm::StringRef | GetRawLineWithUnusedSuffix () const |
Returns the full raw user input used to create this CompletionRequest. | |
unsigned | GetRawCursorPos () const |
const Args & | GetParsedLine () const |
Args & | GetParsedLine () |
const Args::ArgEntry & | GetParsedArg () |
size_t | GetCursorCharPos () const |
void | ShiftArguments () |
Drops the first argument from the argument list. | |
void | AppendEmptyArgument () |
Adds an empty argument at the end of the argument list and moves the cursor to this new argument. | |
size_t | GetCursorIndex () const |
size_t | GetMaxReturnElements () const |
bool | ShouldAddCompletions () const |
Returns true if the maximum number of completions has not been reached yet, hence we should keep adding completions. | |
size_t | GetMaxNumberOfCompletionsToAdd () const |
Returns the maximum number of completions that need to be added until reaching the maximum. | |
void | AddCompletion (llvm::StringRef completion, llvm::StringRef description="", CompletionMode mode=CompletionMode::Normal) |
Adds a possible completion string. | |
template<CompletionMode M = CompletionMode::Normal> | |
void | TryCompleteCurrentArg (llvm::StringRef completion, llvm::StringRef description="") |
Adds a possible completion string if the completion would complete the current argument. | |
void | AddCompletions (const StringList &completions) |
Adds multiple possible completion strings. | |
void | AddCompletions (const StringList &completions, const StringList &descriptions) |
Adds multiple possible completion strings alongside their descriptions. | |
llvm::StringRef | GetCursorArgumentPrefix () const |
Private Attributes | |
llvm::StringRef | m_command |
The raw command line we are supposed to complete. | |
unsigned | m_raw_cursor_pos |
The cursor position in m_command. | |
Args | m_parsed_line |
The command line parsed as arguments. | |
size_t | m_cursor_index |
The index of the argument in which the completion cursor is. | |
size_t | m_cursor_char_position |
The cursor position in the argument indexed by m_cursor_index. | |
size_t | m_max_return_elements = std::numeric_limits<size_t>::max() |
The maximum number of completions that should be returned. | |
CompletionResult & | m_result |
The result this request is supposed to fill out. |
"lldb/Utility/ArgCompletionRequest.h"
Contains all information necessary to complete an incomplete command for the user. Will be filled with the generated completions by the different completions functions.
Definition at line 100 of file CompletionRequest.h.
CompletionRequest::CompletionRequest | ( | llvm::StringRef | command_line, |
unsigned | raw_cursor_pos, | ||
CompletionResult & | result ) |
Constructs a completion request.
[in] | command_line | The command line the user has typed at this point. |
[in] | raw_cursor_pos | The position of the cursor in the command line string. Index 0 means the cursor is at the start of the line. The completion starts from this cursor position. |
[out] | result | The CompletionResult that will be filled with the results after this request has been handled. |
Definition at line 14 of file CompletionRequest.cpp.
References AppendEmptyArgument(), CompletionRequest(), lldb_private::Args::GetArgumentCount(), GetCursorArgumentPrefix(), GetParsedLine(), m_command, m_cursor_char_position, m_cursor_index, m_parsed_line, m_raw_cursor_pos, and m_result.
Referenced by CompletionRequest().
|
inline |
Adds a possible completion string.
If the completion was already suggested before, it will not be added to the list of results. A copy of the suggested completion is stored, so the given string can be free'd afterwards.
completion | The suggested completion. |
description | An optional description of the completion string. The description will be displayed to the user alongside the completion. |
mode | The CompletionMode for this completion. |
Definition at line 191 of file CompletionRequest.h.
References m_result, and lldb_private::Normal.
Referenced by AddCompletions(), AddCompletions(), lldb_private::FormatEntity::AutoComplete(), lldb_private::OptionValueEnumeration::AutoComplete(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::AutoCompleteDiskFileOrDirectory(), lldb_private::PluginManager::AutoCompletePlatformName(), lldb_private::PluginManager::AutoCompletePluginName(), lldb_private::PluginManager::AutoCompleteProcessName(), DiskFilesOrDirectories(), lldb_private::CommandInterpreter::HandleCompletion(), lldb_private::Options::HandleOptionCompletion(), lldb_private::IOHandlerConfirm::IOHandlerComplete(), lldb_private::REPL::IOHandlerComplete(), PrivateAutoComplete(), PrivateAutoCompleteMembers(), CommandObjectScriptingObjectParsed::CommandOptions::ProcessCompletionDict(), and TryCompleteCurrentArg().
|
inline |
Adds multiple possible completion strings.
completions | The list of completions. |
Definition at line 220 of file CompletionRequest.h.
References AddCompletion().
Referenced by lldb_private::FormatEntity::AutoComplete(), lldb_private::CommandCompletions::CompleteModifiableCmdPathArgs(), lldb_private::CommandObjectMultiword::HandleCompletion(), lldb_private::CommandInterpreter::HandleCompletionMatches(), and lldb_private::REPL::IOHandlerComplete().
|
inline |
Adds multiple possible completion strings alongside their descriptions.
The number of completions and descriptions must be identical.
completions | The list of completions. |
descriptions | The list of descriptions. |
Definition at line 233 of file CompletionRequest.h.
References AddCompletion(), lldb_private::StringList::GetSize(), lldb_private::StringList::GetStringAtIndex(), and lldbassert.
|
inline |
Adds an empty argument at the end of the argument list and moves the cursor to this new argument.
Definition at line 157 of file CompletionRequest.h.
References m_cursor_char_position, m_cursor_index, and m_parsed_line.
Referenced by CompletionRequest(), lldb_private::CommandObjectMultiword::HandleCompletion(), and lldb_private::CommandInterpreter::HandleCompletionMatches().
|
inline |
Definition at line 241 of file CompletionRequest.h.
References lldb_private::Args::GetArgumentAtIndex(), GetCursorIndex(), and GetParsedLine().
Referenced by lldb_private::FormatEntity::AutoComplete(), lldb_private::OptionValueBoolean::AutoComplete(), lldb_private::OptionValueEnumeration::AutoComplete(), lldb_private::OptionValueUUID::AutoComplete(), lldb_private::Variable::AutoComplete(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::AutoCompleteDiskFileOrDirectory(), CompletionRequest(), DiskFilesOrDirectories(), lldb::SBCommandInterpreter::HandleCompletionWithDescriptions(), lldb_private::Options::HandleOptionCompletion(), lldb_private::CommandCompletions::ManagedPlugins(), lldb_private::CommandCompletions::PlatformPluginNames(), lldb_private::CommandCompletions::ProcessPluginNames(), lldb_private::CommandCompletions::Registers(), lldb_private::Editline::TabCommand(), and TryCompleteCurrentArg().
|
inline |
Definition at line 147 of file CompletionRequest.h.
References m_cursor_char_position.
Referenced by CommandObjectScriptingObjectParsed::HandleArgumentCompletion(), and CommandObjectScriptingObjectParsed::CommandOptions::HandleOptionArgumentCompletion().
|
inline |
Definition at line 163 of file CompletionRequest.h.
References m_cursor_index.
Referenced by CompleteEnableDisable(), GetCursorArgumentPrefix(), GetParsedArg(), CommandObjectCommandsDelete::HandleArgumentCompletion(), CommandObjectCommandsUnalias::HandleArgumentCompletion(), CommandObjectPlatformGetFile::HandleArgumentCompletion(), CommandObjectPlatformInstall::HandleArgumentCompletion(), CommandObjectProcessSignal::HandleArgumentCompletion(), CommandObjectProcessUnload::HandleArgumentCompletion(), CommandObjectRegisterWrite::HandleArgumentCompletion(), CommandObjectScriptingObjectParsed::HandleArgumentCompletion(), CommandObjectSettingsAppend::HandleArgumentCompletion(), CommandObjectSettingsClear::HandleArgumentCompletion(), CommandObjectSettingsInsertAfter::HandleArgumentCompletion(), CommandObjectSettingsInsertBefore::HandleArgumentCompletion(), CommandObjectSettingsRemove::HandleArgumentCompletion(), CommandObjectSettingsReplace::HandleArgumentCompletion(), CommandObjectTargetModulesSearchPathsInsert::HandleArgumentCompletion(), CommandObjectTargetStopHookDelete::HandleArgumentCompletion(), CommandObjectTargetStopHookEnableDisable::HandleArgumentCompletion(), CommandObjectThreadPlanDiscard::HandleArgumentCompletion(), CommandObjectThreadSelect::HandleArgumentCompletion(), CommandObjectThreadStepWithTypeAndScope::HandleArgumentCompletion(), CommandObjectTypeFormatterDelete::HandleArgumentCompletion(), CommandObjectWithFrameRecognizerArg::HandleArgumentCompletion(), lldb_private::CommandObject::HandleArgumentCompletion(), lldb_private::CommandObject::HandleCompletion(), lldb_private::CommandObjectHelp::HandleCompletion(), lldb_private::CommandObjectMultiword::HandleCompletion(), lldb_private::CommandInterpreter::HandleCompletionMatches(), lldb_private::Options::HandleOptionCompletion(), lldb_private::REPL::IOHandlerComplete(), and lldb_private::Editline::TabCommand().
|
inline |
Returns the maximum number of completions that need to be added until reaching the maximum.
Definition at line 175 of file CompletionRequest.h.
References m_max_return_elements, and m_result.
Referenced by ShouldAddCompletions().
|
inline |
Definition at line 165 of file CompletionRequest.h.
References m_max_return_elements.
|
inline |
Definition at line 143 of file CompletionRequest.h.
References GetCursorIndex(), and GetParsedLine().
Referenced by lldb::SBCommandInterpreter::HandleCompletionWithDescriptions(), and lldb_private::Editline::TabCommand().
|
inline |
Definition at line 141 of file CompletionRequest.h.
References m_parsed_line.
|
inline |
Definition at line 139 of file CompletionRequest.h.
References m_parsed_line.
Referenced by CompleteEnableDisable(), lldb_private::CommandCompletions::CompleteModifiableCmdPathArgs(), CompletionRequest(), GetCursorArgumentPrefix(), GetParsedArg(), CommandObjectScriptingObjectParsed::HandleArgumentCompletion(), lldb_private::CommandInterpreter::HandleCompletion(), lldb_private::CommandObject::HandleCompletion(), lldb_private::CommandObjectHelp::HandleCompletion(), lldb_private::CommandObjectMultiword::HandleCompletion(), lldb_private::CommandInterpreter::HandleCompletionMatches(), lldb::SBCommandInterpreter::HandleCompletionWithDescriptions(), CommandObjectBreakpointRead::CommandOptions::HandleOptionArgumentCompletion(), lldb_private::Options::HandleOptionArgumentCompletion(), CommandObjectScriptingObjectParsed::CommandOptions::PrepareOptionsForCompletion(), and lldb_private::Editline::TabCommand().
|
inline |
Definition at line 137 of file CompletionRequest.h.
References m_raw_cursor_pos.
Referenced by GetRawLine(), lldb_private::IOHandlerConfirm::IOHandlerComplete(), and lldb_private::REPL::IOHandlerComplete().
|
inline |
Returns the raw user input used to create this CompletionRequest cut off at the cursor position.
The cursor will be at the end of the raw line.
Definition at line 125 of file CompletionRequest.h.
References GetRawCursorPos(), and m_command.
Referenced by lldb_private::REPL::IOHandlerComplete().
|
inline |
Returns the full raw user input used to create this CompletionRequest.
This string is not cut off at the cursor position and will include characters behind the cursor position.
You should most likely not use this function unless the characters behind the cursor position influence the completion.
Definition at line 135 of file CompletionRequest.h.
References m_command.
|
inline |
Sets the maximum number of completions that should be returned.
Definition at line 119 of file CompletionRequest.h.
References m_max_return_elements.
Referenced by lldb::SBCommandInterpreter::HandleCompletionWithDescriptions().
|
inline |
Drops the first argument from the argument list.
Definition at line 150 of file CompletionRequest.h.
References m_cursor_index, and m_parsed_line.
Referenced by lldb_private::CommandObjectHelp::HandleCompletion(), lldb_private::CommandObjectMultiword::HandleCompletion(), and lldb_private::CommandInterpreter::HandleCompletionMatches().
|
inline |
Returns true if the maximum number of completions has not been reached yet, hence we should keep adding completions.
Definition at line 169 of file CompletionRequest.h.
References GetMaxNumberOfCompletionsToAdd().
Referenced by DiskFilesOrDirectories(), and lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks().
|
inline |
Adds a possible completion string if the completion would complete the current argument.
completion | The suggested completion. |
description | An optional description of the completion string. The description will be displayed to the user alongside the completion. |
Definition at line 204 of file CompletionRequest.h.
References AddCompletion(), GetCursorArgumentPrefix(), and lldb_private::RewriteLine.
Referenced by lldb_private::ArchSpec::AutoComplete(), lldb_private::FormattersContainer< TypeSummaryImpl >::AutoComplete(), lldb_private::OptionValueBoolean::AutoComplete(), lldb_private::OptionValueEnumeration::AutoComplete(), lldb_private::OptionValueUUID::AutoComplete(), lldb_private::Thread::AutoCompleteThreadPlans(), lldb_private::CommandCompletions::BreakpointNames(), lldb_private::CommandCompletions::Breakpoints(), CompleteEnableDisable(), lldb_private::CommandCompletions::DisassemblyFlavors(), lldb_private::CommandCompletions::FrameIndexes(), CommandObjectCommandsDelete::HandleArgumentCompletion(), CommandObjectCommandsUnalias::HandleArgumentCompletion(), CommandObjectLogList::HandleArgumentCompletion(), CommandObjectLogTimerIncrement::HandleArgumentCompletion(), CommandObjectProcessSignal::HandleArgumentCompletion(), CommandObjectProcessUnload::HandleArgumentCompletion(), CommandObjectTargetModulesSearchPathsInsert::HandleArgumentCompletion(), CommandObjectWithFrameRecognizerArg::HandleArgumentCompletion(), CommandObjectBreakpointRead::CommandOptions::HandleOptionArgumentCompletion(), lldb_private::Options::HandleOptionArgumentCompletion(), lldb_private::CommandCompletions::ModuleUUIDs(), lldb_private::CommandCompletions::ProcessIDs(), lldb_private::CommandCompletions::ProcessNames(), lldb_private::CommandCompletions::Registers(), lldb_private::CommandCompletions::SettingsNames(), lldb_private::CommandCompletions::StopHookIDs(), lldb_private::CommandCompletions::ThreadIDs(), lldb_private::CommandCompletions::ThreadIndexes(), lldb_private::CommandCompletions::TypeCategoryNames(), lldb_private::CommandCompletions::TypeLanguages(), and lldb_private::CommandCompletions::WatchPointIDs().
|
private |
The raw command line we are supposed to complete.
Definition at line 247 of file CompletionRequest.h.
Referenced by CompletionRequest(), GetRawLine(), and GetRawLineWithUnusedSuffix().
|
private |
The cursor position in the argument indexed by m_cursor_index.
Definition at line 255 of file CompletionRequest.h.
Referenced by AppendEmptyArgument(), CompletionRequest(), and GetCursorCharPos().
|
private |
The index of the argument in which the completion cursor is.
Definition at line 253 of file CompletionRequest.h.
Referenced by AppendEmptyArgument(), CompletionRequest(), GetCursorIndex(), and ShiftArguments().
|
private |
The maximum number of completions that should be returned.
Definition at line 257 of file CompletionRequest.h.
Referenced by GetMaxNumberOfCompletionsToAdd(), GetMaxReturnElements(), and SetMaxReturnElements().
|
private |
The command line parsed as arguments.
Definition at line 251 of file CompletionRequest.h.
Referenced by AppendEmptyArgument(), CompletionRequest(), GetParsedLine(), GetParsedLine(), and ShiftArguments().
|
private |
The cursor position in m_command.
Definition at line 249 of file CompletionRequest.h.
Referenced by CompletionRequest(), and GetRawCursorPos().
|
private |
The result this request is supposed to fill out.
We keep this object private to ensure that no backend can in any way depend on already calculated completions (which would make debugging and testing them much more complicated).
Definition at line 263 of file CompletionRequest.h.
Referenced by AddCompletion(), CompletionRequest(), and GetMaxNumberOfCompletionsToAdd().