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. | |
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 () |
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 |
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. | |
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(), lldb_private::Args::GetArgumentCount(), GetCursorArgumentPrefix(), GetParsedLine(), m_cursor_char_position, m_cursor_index, and m_parsed_line.
|
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 167 of file CompletionRequest.h.
References lldb_private::CompletionResult::AddResult(), and m_result.
Referenced by AddCompletions(), lldb_private::OptionValueEnumeration::AutoComplete(), lldb_private::FormatEntity::AutoComplete(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::AutoCompleteDiskFileOrDirectory(), lldb_private::PluginManager::AutoCompletePlatformName(), lldb_private::PluginManager::AutoCompleteProcessName(), DiskFilesOrDirectories(), lldb_private::CommandInterpreter::HandleCompletion(), lldb_private::Options::HandleOptionCompletion(), lldb_private::IOHandlerConfirm::IOHandlerComplete(), lldb_private::REPL::IOHandlerComplete(), PrivateAutoComplete(), PrivateAutoCompleteMembers(), and TryCompleteCurrentArg().
|
inline |
Adds multiple possible completion strings.
completions | The list of completions. |
Definition at line 196 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 209 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 150 of file CompletionRequest.h.
References lldb_private::Args::AppendArgument(), 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 217 of file CompletionRequest.h.
References lldb_private::Args::GetArgumentAtIndex(), GetCursorIndex(), and GetParsedLine().
Referenced by lldb_private::OptionValueBoolean::AutoComplete(), lldb_private::OptionValueEnumeration::AutoComplete(), lldb_private::OptionValueUUID::AutoComplete(), lldb_private::Variable::AutoComplete(), lldb_private::FormatEntity::AutoComplete(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::AutoCompleteDiskFileOrDirectory(), CompletionRequest(), DiskFilesOrDirectories(), lldb::SBCommandInterpreter::HandleCompletionWithDescriptions(), lldb_private::Options::HandleOptionCompletion(), lldb_private::CommandCompletions::PlatformPluginNames(), lldb_private::CommandCompletions::ProcessPluginNames(), lldb_private::CommandCompletions::Registers(), lldb_private::Editline::TabCommand(), and TryCompleteCurrentArg().
|
inline |
Definition at line 156 of file CompletionRequest.h.
References m_cursor_index.
Referenced by CompleteEnableDisable(), GetCursorArgumentPrefix(), GetParsedArg(), lldb_private::CommandObject::HandleArgumentCompletion(), CommandObjectCommandsUnalias::HandleArgumentCompletion(), CommandObjectCommandsDelete::HandleArgumentCompletion(), CommandObjectFrameRecognizerDelete::HandleArgumentCompletion(), CommandObjectPlatformGetFile::HandleArgumentCompletion(), CommandObjectPlatformInstall::HandleArgumentCompletion(), CommandObjectProcessUnload::HandleArgumentCompletion(), CommandObjectProcessSignal::HandleArgumentCompletion(), CommandObjectRegisterWrite::HandleArgumentCompletion(), CommandObjectRegisterInfo::HandleArgumentCompletion(), CommandObjectSettingsRemove::HandleArgumentCompletion(), CommandObjectSettingsReplace::HandleArgumentCompletion(), CommandObjectSettingsInsertBefore::HandleArgumentCompletion(), CommandObjectSettingsInsertAfter::HandleArgumentCompletion(), CommandObjectSettingsAppend::HandleArgumentCompletion(), CommandObjectSettingsClear::HandleArgumentCompletion(), CommandObjectTargetModulesSearchPathsInsert::HandleArgumentCompletion(), CommandObjectTargetStopHookDelete::HandleArgumentCompletion(), CommandObjectTargetStopHookEnableDisable::HandleArgumentCompletion(), CommandObjectThreadStepWithTypeAndScope::HandleArgumentCompletion(), CommandObjectThreadSelect::HandleArgumentCompletion(), CommandObjectThreadPlanDiscard::HandleArgumentCompletion(), CommandObjectTypeFormatterDelete::HandleArgumentCompletion(), lldb_private::CommandObject::HandleCompletion(), lldb_private::CommandObjectMultiword::HandleCompletion(), lldb_private::CommandObjectHelp::HandleCompletion(), lldb_private::CommandInterpreter::HandleCompletionMatches(), lldb_private::Options::HandleOptionCompletion(), lldb_private::REPL::IOHandlerComplete(), and lldb_private::Editline::TabCommand().
|
inline |
Definition at line 138 of file CompletionRequest.h.
References GetCursorIndex(), and GetParsedLine().
Referenced by lldb::SBCommandInterpreter::HandleCompletionWithDescriptions(), and lldb_private::Editline::TabCommand().
|
inline |
Definition at line 136 of file CompletionRequest.h.
References m_parsed_line.
|
inline |
Definition at line 134 of file CompletionRequest.h.
References m_parsed_line.
Referenced by CompleteEnableDisable(), lldb_private::CommandCompletions::CompleteModifiableCmdPathArgs(), CompletionRequest(), GetCursorArgumentPrefix(), GetParsedArg(), lldb_private::CommandInterpreter::HandleCompletion(), lldb_private::CommandObject::HandleCompletion(), lldb_private::CommandObjectMultiword::HandleCompletion(), lldb_private::CommandObjectHelp::HandleCompletion(), lldb_private::CommandInterpreter::HandleCompletionMatches(), lldb::SBCommandInterpreter::HandleCompletionWithDescriptions(), CommandObjectBreakpointRead::CommandOptions::HandleOptionArgumentCompletion(), lldb_private::Options::HandleOptionArgumentCompletion(), and lldb_private::Editline::TabCommand().
|
inline |
Definition at line 132 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 120 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 130 of file CompletionRequest.h.
References m_command.
|
inline |
Drops the first argument from the argument list.
Definition at line 143 of file CompletionRequest.h.
References m_cursor_index, m_parsed_line, and lldb_private::Args::Shift().
Referenced by lldb_private::CommandObjectMultiword::HandleCompletion(), lldb_private::CommandObjectHelp::HandleCompletion(), and lldb_private::CommandInterpreter::HandleCompletionMatches().
|
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 180 of file CompletionRequest.h.
References AddCompletion(), GetCursorArgumentPrefix(), and lldb_private::RewriteLine.
Referenced by lldb_private::OptionValueBoolean::AutoComplete(), lldb_private::OptionValueEnumeration::AutoComplete(), lldb_private::OptionValueUUID::AutoComplete(), lldb_private::FormattersContainer< ValueType >::AutoComplete(), lldb_private::ArchSpec::AutoComplete(), lldb_private::Thread::AutoCompleteThreadPlans(), lldb_private::CommandCompletions::BreakpointNames(), lldb_private::CommandCompletions::Breakpoints(), CompleteEnableDisable(), lldb_private::CommandCompletions::DisassemblyFlavors(), lldb_private::CommandCompletions::FrameIndexes(), CommandObjectCommandsUnalias::HandleArgumentCompletion(), CommandObjectCommandsDelete::HandleArgumentCompletion(), CommandObjectFrameRecognizerDelete::HandleArgumentCompletion(), CommandObjectLogList::HandleArgumentCompletion(), CommandObjectLogTimerIncrement::HandleArgumentCompletion(), CommandObjectProcessUnload::HandleArgumentCompletion(), CommandObjectProcessSignal::HandleArgumentCompletion(), CommandObjectTargetModulesSearchPathsInsert::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 223 of file CompletionRequest.h.
Referenced by GetRawLine(), and GetRawLineWithUnusedSuffix().
|
private |
The cursor position in the argument indexed by m_cursor_index.
Definition at line 231 of file CompletionRequest.h.
Referenced by AppendEmptyArgument(), and CompletionRequest().
|
private |
The index of the argument in which the completion cursor is.
Definition at line 229 of file CompletionRequest.h.
Referenced by AppendEmptyArgument(), CompletionRequest(), GetCursorIndex(), and ShiftArguments().
|
private |
The command line parsed as arguments.
Definition at line 227 of file CompletionRequest.h.
Referenced by AppendEmptyArgument(), CompletionRequest(), GetParsedLine(), and ShiftArguments().
|
private |
The cursor position in m_command.
Definition at line 225 of file CompletionRequest.h.
Referenced by 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 237 of file CompletionRequest.h.
Referenced by AddCompletion().