Go to the documentation of this file.
9 #ifndef LLDB_UTILITY_COMPLETIONREQUEST_H
10 #define LLDB_UTILITY_COMPLETIONREQUEST_H
15 #include "llvm/ADT/StringRef.h"
16 #include "llvm/ADT/StringSet.h"
53 Completion(llvm::StringRef completion, llvm::StringRef description,
75 void AddResult(llvm::StringRef completion, llvm::StringRef description,
168 llvm::StringRef description =
"",
179 template <CompletionMode M = CompletionMode::Normal>
181 llvm::StringRef description =
"") {
186 "Shouldn't rewrite line with this function");
212 for (std::size_t i = 0; i < completions.
GetSize(); ++i)
242 #endif // LLDB_UTILITY_COMPLETIONREQUEST_H
unsigned GetRawCursorPos() const
const Args::ArgEntry & GetParsedArg()
@ Partial
The current token has been partially completed.
const Args & GetParsedLine() const
void TryCompleteCurrentArg(llvm::StringRef completion, llvm::StringRef description="")
Adds a possible completion string if the completion would complete the current argument.
void Shift()
Shifts the first argument C string value of the array off the argument array.
void AppendArgument(llvm::StringRef arg_str, char quote_char='\0')
Appends a new argument to the end of the list argument list.
A single completion and all associated data.
Args m_parsed_line
The command line parsed as arguments.
void AppendEmptyArgument()
Adds an empty argument at the end of the argument list and moves the cursor to this new argument.
void GetMatches(StringList &matches) const
Adds all collected completion matches to the given list.
size_t m_cursor_char_position
The cursor position in the argument indexed by m_cursor_index.
const char * GetStringAtIndex(size_t idx) const
llvm::ArrayRef< Completion > GetResults() const
@ RewriteLine
The full line has been rewritten by the completion.
void AddCompletions(const StringList &completions, const StringList &descriptions)
Adds multiple possible completion strings alongside their descriptions.
Completion(llvm::StringRef completion, llvm::StringRef description, CompletionMode mode)
std::string m_descripton
The description that should be displayed to the user alongside the completion text.
@ Normal
The current token has been completed.
const std::string & GetDescription() const
CompletionRequest(llvm::StringRef command_line, unsigned raw_cursor_pos, CompletionResult &result)
Constructs a completion request.
std::string GetUniqueKey() const
Generates a string that uniquely identifies this completion result.
llvm::StringRef GetCursorArgumentPrefix() const
string(SUBSTRING ${p} 10 -1 pStripped) if($
void AddCompletions(const StringList &completions)
Adds multiple possible completion strings.
llvm::StringSet m_added_values
A set of the unique keys of all found completions so far.
CompletionResult & m_result
The result this request is supposed to fill out.
llvm::StringRef GetRawLine() const
Returns the raw user input used to create this CompletionRequest cut off at the cursor position.
const char * GetArgumentAtIndex(size_t idx) const
Gets the NULL terminated C string argument pointer for the argument at index idx.
void AddResult(llvm::StringRef completion, llvm::StringRef description, CompletionMode mode)
llvm::StringRef m_command
The raw command line we are supposed to complete.
const std::string & GetCompletion() const
void ShiftArguments()
Drops the first argument from the argument list.
size_t GetCursorIndex() const
std::vector< Completion > m_results
List of found completions.
A class that represents a running process on the host machine.
CompletionMode GetMode() const
void AddCompletion(llvm::StringRef completion, llvm::StringRef description="", CompletionMode mode=CompletionMode::Normal)
Adds a possible completion string.
unsigned m_raw_cursor_pos
The cursor position in m_command.
llvm::StringRef GetRawLineWithUnusedSuffix() const
Returns the full raw user input used to create this CompletionRequest.
std::size_t GetNumberOfResults() const
size_t m_cursor_index
The index of the argument in which the completion cursor is.
void GetDescriptions(StringList &descriptions) const
Adds all collected completion descriptions to the given list.
std::string m_completion
The actual text that should be completed.