logic: handle activation of non-indexed files and tokens referenced within non-indexed files
This commit is contained in:
@@ -1222,6 +1222,17 @@ std::shared_ptr<SourceLocationCollection> PersistentStorage::getSourceLocationsF
|
|||||||
for (const Id tokenId : tokenIds)
|
for (const Id tokenId : tokenIds)
|
||||||
{
|
{
|
||||||
FilePath path = getFileNodePath(tokenId);
|
FilePath path = getFileNodePath(tokenId);
|
||||||
|
|
||||||
|
// check for non-indexed file
|
||||||
|
if (path.empty() && m_symbolDefinitionKinds.find(tokenId) == m_symbolDefinitionKinds.end())
|
||||||
|
{
|
||||||
|
StorageNode fileNode = m_sqliteIndexStorage.getNodeById(tokenId);
|
||||||
|
if (Node::intToType(fileNode.type) == Node::NODE_FILE)
|
||||||
|
{
|
||||||
|
path = FilePath(NameHierarchy::deserialize(fileNode.serializedName).getQualifiedName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (path.empty())
|
if (path.empty())
|
||||||
{
|
{
|
||||||
nonFileIds.push_back(tokenId);
|
nonFileIds.push_back(tokenId);
|
||||||
@@ -1253,16 +1264,33 @@ std::shared_ptr<SourceLocationCollection> PersistentStorage::getSourceLocationsF
|
|||||||
auto it = locationIdToElementIdMap.find(sourceLocation.id);
|
auto it = locationIdToElementIdMap.find(sourceLocation.id);
|
||||||
if (it != locationIdToElementIdMap.end())
|
if (it != locationIdToElementIdMap.end())
|
||||||
{
|
{
|
||||||
collection->addSourceLocation(
|
FilePath path = getFileNodePath(sourceLocation.fileNodeId);
|
||||||
intToLocationType(sourceLocation.type),
|
if (path.empty())
|
||||||
sourceLocation.id,
|
{
|
||||||
std::vector<Id>(1, it->second),
|
StorageNode fileNode = m_sqliteIndexStorage.getNodeById(sourceLocation.fileNodeId);
|
||||||
getFileNodePath(sourceLocation.fileNodeId),
|
if (fileNode.id)
|
||||||
sourceLocation.startLine,
|
{
|
||||||
sourceLocation.startCol,
|
FilePath path2 = FilePath(NameHierarchy::deserialize(fileNode.serializedName).getQualifiedName());
|
||||||
sourceLocation.endLine,
|
if (path2.exists())
|
||||||
sourceLocation.endCol
|
{
|
||||||
);
|
path = path2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!path.empty())
|
||||||
|
{
|
||||||
|
collection->addSourceLocation(
|
||||||
|
intToLocationType(sourceLocation.type),
|
||||||
|
sourceLocation.id,
|
||||||
|
std::vector<Id>(1, it->second),
|
||||||
|
path,
|
||||||
|
sourceLocation.startLine,
|
||||||
|
sourceLocation.startCol,
|
||||||
|
sourceLocation.endLine,
|
||||||
|
sourceLocation.endCol
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1703,7 +1731,7 @@ TooltipInfo PersistentStorage::getTooltipInfoForTokenIds(const std::vector<Id>&
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == Node::NODE_FILE)
|
if (type == Node::NODE_FILE && m_fileNodePaths.find(node.id) != m_fileNodePaths.end())
|
||||||
{
|
{
|
||||||
bool complete = false;
|
bool complete = false;
|
||||||
auto it = m_fileNodeComplete.find(node.id);
|
auto it = m_fileNodeComplete.find(node.id);
|
||||||
@@ -2154,7 +2182,7 @@ void PersistentStorage::addNodesToGraph(const std::vector<Id>& newNodeIds, Graph
|
|||||||
{
|
{
|
||||||
const FilePath filePath(NameHierarchy::deserialize(storageNode.serializedName).getRawName());
|
const FilePath filePath(NameHierarchy::deserialize(storageNode.serializedName).getRawName());
|
||||||
|
|
||||||
bool defined = true;
|
bool defined = false;
|
||||||
auto it = m_fileNodeComplete.find(storageNode.id);
|
auto it = m_fileNodeComplete.find(storageNode.id);
|
||||||
if (it != m_fileNodeComplete.end())
|
if (it != m_fileNodeComplete.end())
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user