ui: augmented autocompletion list
This change adds search match information to the autocompletion list: - matching letters - color for token or command - node type as string
This commit is contained in:
@@ -376,6 +376,18 @@ std::vector<SearchMatch> Storage::getAutocompletionMatches(
|
||||
|
||||
std::vector<SearchMatch> matches = SearchIndex::getMatches(tokenResults, word);
|
||||
SearchMatch::log(matches, word);
|
||||
|
||||
for (SearchMatch& match : matches)
|
||||
{
|
||||
if (!match.tokenIds.size())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Token* token = m_graph.getTokenById(*match.tokenIds.cbegin());
|
||||
match.typeName = token->getTypeString();
|
||||
}
|
||||
|
||||
return matches;
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
|
||||
// Logging.
|
||||
std::string getTypeString(EdgeType type) const;
|
||||
std::string getTypeString() const;
|
||||
virtual std::string getTypeString() const;
|
||||
std::string getAsString() const;
|
||||
|
||||
private:
|
||||
|
||||
@@ -79,7 +79,7 @@ public:
|
||||
|
||||
// Logging.
|
||||
std::string getTypeString(NodeType type) const;
|
||||
std::string getTypeString() const;
|
||||
virtual std::string getTypeString() const;
|
||||
std::string getAsString() const;
|
||||
|
||||
private:
|
||||
|
||||
@@ -31,6 +31,9 @@ public:
|
||||
template <typename ComponentType>
|
||||
std::shared_ptr<ComponentType> removeComponent();
|
||||
|
||||
// Logging.
|
||||
virtual std::string getTypeString() const = 0;
|
||||
|
||||
protected:
|
||||
Token(const Token& other);
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ struct SearchMatch
|
||||
std::string encodeForQuery() const;
|
||||
|
||||
std::string fullName;
|
||||
std::string typeName;
|
||||
std::set<Id> tokenIds;
|
||||
std::vector<size_t> indices;
|
||||
size_t weight;
|
||||
|
||||
Reference in New Issue
Block a user