logic: search ui performance optimization
* replaced the implementation of the search index. the search index now uses a search-trie. edges have gates that can be used to check if a character can be matched when following the edge. * SearchMatches now have a text and a list of NameHierarchies that share this node (instead of Ids, so that nodes must be found by names (which makes sure that SearchMatches are still valid after refresh). * when parsing a project's description the CodeController now looks for NameHierarchies instead of SearchNode names to find ids of linked elements.
This commit is contained in:
@@ -582,6 +582,7 @@ std::vector<std::string> CodeController::getProjectDescription(TokenLocationFile
|
||||
return std::vector<std::string>();
|
||||
}
|
||||
|
||||
// todo fixme: this split currently prevents the next step from recognizing multi level name hierarchies.
|
||||
std::vector<std::string> lines = utility::splitToVector(description, "\\n");
|
||||
size_t startLineNumber = 4;
|
||||
|
||||
@@ -590,6 +591,7 @@ std::vector<std::string> CodeController::getProjectDescription(TokenLocationFile
|
||||
std::string line = "\t" + lines[i];
|
||||
|
||||
line = utility::replace(line, "\\t", "\t");
|
||||
line = utility::replace(line, "\\r", "\r");
|
||||
|
||||
size_t pos = 0;
|
||||
while (pos != std::string::npos)
|
||||
@@ -602,21 +604,23 @@ std::vector<std::string> CodeController::getProjectDescription(TokenLocationFile
|
||||
break;
|
||||
}
|
||||
|
||||
std::string tokenName = line.substr(posA + 1, posB - posA - 1);
|
||||
std::string serializedName = line.substr(posA + 1, posB - posA - 1);
|
||||
|
||||
Id tokenId = m_storageAccess->getIdForNodeWithSearchNameHierarchy(NameHierarchy(tokenName));
|
||||
NameHierarchy nameHierarchy = NameHierarchy::deserialize(serializedName);
|
||||
Id tokenId = m_storageAccess->getIdForNodeWithNameHierarchy(nameHierarchy);
|
||||
|
||||
if (tokenId > 0)
|
||||
{
|
||||
line.replace(posA, posB - posA + 1, tokenName);
|
||||
std::string nameString = nameHierarchy.getQualifiedName();
|
||||
line.replace(posA, posB - posA + 1, nameString);
|
||||
locationFile->addTokenLocation(
|
||||
0, tokenId,
|
||||
startLineNumber + i, posA + 1,
|
||||
startLineNumber + i, posA + tokenName.size()
|
||||
startLineNumber + i, posA + nameString.size()
|
||||
);
|
||||
}
|
||||
|
||||
pos = posA + tokenName.size();
|
||||
pos = posA + serializedName.size();
|
||||
}
|
||||
|
||||
lines[i] = line;
|
||||
|
||||
Reference in New Issue
Block a user