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");
197 for (
const std::string &completion : completions)
212 for (std::size_t i = 0; i < completions.
GetSize(); ++i)
A command line argument class.
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.
const char * GetArgumentAtIndex(size_t idx) const
Gets the NULL terminated C string argument pointer for the argument at index idx.
"lldb/Utility/ArgCompletionRequest.h"
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.
void AddCompletion(llvm::StringRef completion, llvm::StringRef description="", CompletionMode mode=CompletionMode::Normal)
Adds a possible completion string.
void AddCompletions(const StringList &completions)
Adds multiple possible completion strings.
llvm::StringRef GetRawLine() const
Returns the raw user input used to create this CompletionRequest cut off at the cursor position.
void AddCompletions(const StringList &completions, const StringList &descriptions)
Adds multiple possible completion strings alongside their descriptions.
unsigned GetRawCursorPos() const
const Args & GetParsedLine() const
llvm::StringRef GetCursorArgumentPrefix() const
void ShiftArguments()
Drops the first argument from the argument list.
llvm::StringRef GetRawLineWithUnusedSuffix() const
Returns the full raw user input used to create this CompletionRequest.
size_t m_cursor_index
The index of the argument in which the completion cursor is.
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.
llvm::StringRef m_command
The raw command line we are supposed to complete.
void TryCompleteCurrentArg(llvm::StringRef completion, llvm::StringRef description="")
Adds a possible completion string if the completion would complete the current argument.
const Args::ArgEntry & GetParsedArg()
unsigned m_raw_cursor_pos
The cursor position in m_command.
size_t GetCursorIndex() const
A single completion and all associated data.
const std::string & GetCompletion() const
std::string m_descripton
The description that should be displayed to the user alongside the completion text.
std::string m_completion
The actual text that should be completed.
const std::string & GetDescription() const
Completion(llvm::StringRef completion, llvm::StringRef description, CompletionMode mode)
CompletionMode GetMode() const
std::string GetUniqueKey() const
Generates a string that uniquely identifies this completion result.
llvm::ArrayRef< Completion > GetResults() const
std::vector< Completion > m_results
List of found completions.
void AddResult(llvm::StringRef completion, llvm::StringRef description, CompletionMode mode)
void GetDescriptions(StringList &descriptions) const
Adds all collected completion descriptions to the given list.
std::size_t GetNumberOfResults() const
void GetMatches(StringList &matches) const
Adds all collected completion matches to the given list.
llvm::StringSet m_added_values
A set of the unique keys of all found completions so far.
const char * GetStringAtIndex(size_t idx) const
A class that represents a running process on the host machine.
@ Partial
The current token has been partially completed.
@ Normal
The current token has been completed.
@ RewriteLine
The full line has been rewritten by the completion.