| 1234567891011121314151617181920212223242526272829 |
- #pragma once
- #include <string>
- #include <vector>
- #include <memory>
- namespace lumacs {
- /// @brief Represents a single completion candidate.
- struct CompletionCandidate {
- std::string text; ///< The completed text.
- std::string display_text; ///< Optional: Text to display to the user (can be richer).
- std::string description; ///< Optional: A short description of the candidate.
- int score; ///< Matching score (higher is better).
- CompletionCandidate(std::string text, int score = 0, std::string display = "", std::string desc = "")
- : text(std::move(text)), display_text(std::move(display)), description(std::move(desc)), score(score) {
- if (display_text.empty()) {
- display_text = this->text;
- }
- }
- bool operator<(const CompletionCandidate& other) const {
- if (score != other.score) return score > other.score; // Higher score first
- return text < other.text; // Alphabetical for same score
- }
- };
- } // namespace lumacs
|