ui: Show list in tooltip when clicking source location with multiple tokens or local symbols

* Also shows list of all implicit symbols at a source location e.g. default constructors or template specializations
This commit is contained in:
Eberhard Graether
2017-08-02 12:32:13 +02:00
parent 91969770d5
commit 8c5b69dce6
14 changed files with 207 additions and 114 deletions
+1 -71
View File
@@ -14,8 +14,6 @@
#include "data/location/SourceLocationFile.h"
#include "utility/messaging/type/MessageActivateLocalSymbols.h"
#include "utility/messaging/type/MessageActivateSourceLocations.h"
#include "utility/messaging/type/MessageActivateTokenIds.h"
#include "utility/messaging/type/MessageFocusIn.h"
#include "utility/messaging/type/MessageFocusOut.h"
#include "utility/messaging/type/MessageMoveIDECursor.h"
@@ -364,8 +362,7 @@ void QtCodeArea::mouseReleaseEvent(QMouseEvent* event)
}
else
{
activateSourceLocations(annotations);
activateLocalSymbols(annotations);
activateAnnotations(annotations);
}
}
else if (m_navigator->getActiveLocalSymbolIds().size())
@@ -518,73 +515,6 @@ void QtCodeArea::setIDECursorPosition()
MessageMoveIDECursor(getSourceLocationFile()->getFilePath().str(), lineColumn.first, lineColumn.second).dispatch();
}
void QtCodeArea::activateSourceLocations(const std::vector<const Annotation*>& annotations)
{
std::vector<Id> locationIds;
std::set<Id> tokenIds;
bool allActive = true;
for (const Annotation* annotation : annotations)
{
if (annotation->locationType == LOCATION_TOKEN)
{
if (!annotation->isActive)
{
allActive = false;
}
if (annotation->locationId > 0)
{
locationIds.push_back(annotation->locationId);
}
if (annotation->tokenIds.size())
{
tokenIds.insert(annotation->tokenIds.begin(), annotation->tokenIds.end());
}
}
}
if (!allActive)
{
if (locationIds.size())
{
MessageActivateSourceLocations(locationIds).dispatch();
}
else if (tokenIds.size()) // fallback for links in project description
{
MessageActivateTokenIds(utility::toVector(tokenIds)).dispatch();
}
}
}
void QtCodeArea::activateLocalSymbols(const std::vector<const Annotation*>& annotations)
{
std::vector<Id> localSymbolIds;
bool allActive = true;
for (const Annotation* annotation : annotations)
{
if (annotation->locationType == LOCATION_LOCAL_SYMBOL)
{
if (!annotation->isActive)
{
allActive = false;
}
if (annotation->tokenIds.size())
{
localSymbolIds.insert(localSymbolIds.end(), annotation->tokenIds.begin(), annotation->tokenIds.end());
}
}
}
if (!allActive || localSymbolIds.size())
{
MessageActivateLocalSymbols(localSymbolIds).dispatch();
}
}
void QtCodeArea::activateErrors(const std::vector<const Annotation*>& annotations)
{
std::vector<Id> errorIds;