15 unsigned raw_cursor_pos,
17 : m_command(command_line), m_raw_cursor_pos(raw_cursor_pos),
19 assert(raw_cursor_pos <= command_line.size() &&
"Out of bounds cursor?");
24 llvm::StringRef partial_command(command_line.substr(0, raw_cursor_pos));
39 if (partial_command.ends_with(
" ") &&
55 result.append(std::to_string(
static_cast<int>(
m_mode)));
62 llvm::StringRef description,
A command line argument class.
size_t GetArgumentCount() const
Gets the number of arguments left in this command object.
size_t m_cursor_char_position
The cursor position in the argument indexed by m_cursor_index.
CompletionRequest(llvm::StringRef command_line, unsigned raw_cursor_pos, CompletionResult &result)
Constructs a completion request.
const Args & GetParsedLine() const
llvm::StringRef GetCursorArgumentPrefix() const
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.
A single completion and all associated data.
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.
std::string GetUniqueKey() const
Generates a string that uniquely identifies this completion result.
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.
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.
void AppendString(const std::string &s)
A class that represents a running process on the host machine.