logic: implemented Python post processing to add ambiguous edges for unsolved symbols
This commit is contained in:
@@ -217,7 +217,12 @@ void QtCodeField::paintEvent(QPaintEvent* event)
|
||||
continue;
|
||||
}
|
||||
|
||||
painter.setPen(QPen(color.border.c_str()));
|
||||
QPen pen(color.border.c_str());
|
||||
if (annotation.locationType == LOCATION_UNSOLVED)
|
||||
{
|
||||
pen.setStyle(Qt::DashLine);
|
||||
}
|
||||
painter.setPen(pen);
|
||||
painter.setBrush(QBrush(color.fill.c_str()));
|
||||
|
||||
if (annotation.locationType == LOCATION_SCOPE)
|
||||
@@ -451,9 +456,12 @@ void QtCodeField::activateAnnotations(const std::vector<const Annotation*>& anno
|
||||
std::set<Id> tokenIds;
|
||||
std::set<Id> localSymbolIds;
|
||||
|
||||
bool containsUnsolved = false;
|
||||
|
||||
for (const Annotation* annotation : annotations)
|
||||
{
|
||||
if (annotation->locationType == LOCATION_TOKEN || annotation->locationType == LOCATION_QUALIFIER)
|
||||
if (annotation->locationType == LOCATION_TOKEN || annotation->locationType == LOCATION_QUALIFIER ||
|
||||
annotation->locationType == LOCATION_UNSOLVED)
|
||||
{
|
||||
if (annotation->locationId > 0)
|
||||
{
|
||||
@@ -464,6 +472,11 @@ void QtCodeField::activateAnnotations(const std::vector<const Annotation*>& anno
|
||||
{
|
||||
tokenIds.insert(annotation->tokenIds.begin(), annotation->tokenIds.end());
|
||||
}
|
||||
|
||||
if (annotation->locationType == LOCATION_UNSOLVED)
|
||||
{
|
||||
containsUnsolved = true;
|
||||
}
|
||||
}
|
||||
else if (annotation->locationType == LOCATION_LOCAL_SYMBOL)
|
||||
{
|
||||
@@ -480,7 +493,7 @@ void QtCodeField::activateAnnotations(const std::vector<const Annotation*>& anno
|
||||
}
|
||||
else if (locationIds.size())
|
||||
{
|
||||
MessageActivateSourceLocations(locationIds).dispatch();
|
||||
MessageActivateSourceLocations(locationIds, containsUnsolved).dispatch();
|
||||
}
|
||||
else if (tokenIds.size()) // fallback for links in project description
|
||||
{
|
||||
@@ -681,7 +694,8 @@ std::vector<const QtCodeField::Annotation*> QtCodeField::getInteractiveAnnotatio
|
||||
for (const Annotation& annotation : m_annotations)
|
||||
{
|
||||
const LocationType& type = annotation.locationType;
|
||||
if ((type == LOCATION_TOKEN || type == LOCATION_QUALIFIER || type == LOCATION_LOCAL_SYMBOL || type == LOCATION_ERROR)
|
||||
if ((type == LOCATION_TOKEN || type == LOCATION_QUALIFIER || type == LOCATION_LOCAL_SYMBOL
|
||||
|| type == LOCATION_UNSOLVED || type == LOCATION_ERROR)
|
||||
&& pos >= annotation.start && pos <= annotation.end)
|
||||
{
|
||||
annotations.push_back(&annotation);
|
||||
@@ -697,7 +711,7 @@ void QtCodeField::checkOpenInTabActionEnabled(QPoint position)
|
||||
for (const Annotation* annotation : getInteractiveAnnotationsForPosition(position))
|
||||
{
|
||||
const LocationType& type = annotation->locationType;
|
||||
if (type == LOCATION_TOKEN || type == LOCATION_QUALIFIER)
|
||||
if (type == LOCATION_TOKEN || type == LOCATION_QUALIFIER || type == LOCATION_UNSOLVED)
|
||||
{
|
||||
locationIds.emplace_back(annotation->locationId);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "Edge.h"
|
||||
#include "TokenComponentAggregation.h"
|
||||
#include "TokenComponentInheritanceChain.h"
|
||||
#include "TokenComponentIsAmbiguous.h"
|
||||
#include "QtLineItemAngled.h"
|
||||
#include "QtLineItemBezier.h"
|
||||
#include "QtLineItemStraight.h"
|
||||
@@ -95,7 +96,8 @@ void QtGraphEdge::updateLine()
|
||||
const QtGraphNode* target = m_target;
|
||||
|
||||
Edge::EdgeType type = (getData() ? getData()->getType() : Edge::EDGE_AGGREGATION);
|
||||
GraphViewStyle::EdgeStyle style = GraphViewStyle::getStyleForEdgeType(type, m_isActive | m_isFocused, false, m_isTrailEdge);
|
||||
GraphViewStyle::EdgeStyle style =
|
||||
GraphViewStyle::getStyleForEdgeType(type, m_isActive | m_isFocused, false, m_isTrailEdge, isAmbiguous());
|
||||
|
||||
Vec4i ownerRect = owner->getBoundingRect();
|
||||
Vec4i targetRect = target->getBoundingRect();
|
||||
@@ -363,6 +365,11 @@ void QtGraphEdge::focusIn()
|
||||
TooltipInfo info;
|
||||
info.title = Edge::getReadableTypeString(type);
|
||||
|
||||
if (isAmbiguous())
|
||||
{
|
||||
info.title = L"ambiguous " + info.title;
|
||||
}
|
||||
|
||||
if (type == Edge::EDGE_AGGREGATION && m_direction == TokenComponentAggregation::DIRECTION_NONE)
|
||||
{
|
||||
info.title = L"bidirectional " + info.title;
|
||||
@@ -506,3 +513,8 @@ void QtGraphEdge::clearPath()
|
||||
{
|
||||
m_path.clear();
|
||||
}
|
||||
|
||||
bool QtGraphEdge::isAmbiguous() const
|
||||
{
|
||||
return m_data && m_data->getComponent<TokenComponentIsAmbiguous>();
|
||||
}
|
||||
|
||||
@@ -60,6 +60,8 @@ public:
|
||||
void setUseBezier(bool useBezier);
|
||||
void clearPath();
|
||||
|
||||
bool isAmbiguous() const;
|
||||
|
||||
protected:
|
||||
virtual void mousePressEvent(QGraphicsSceneMouseEvent* event);
|
||||
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent* event);
|
||||
|
||||
@@ -373,7 +373,20 @@ void QtProjectWizzardContentPreferences::populate(QGridLayout* layout, int& row)
|
||||
|
||||
addGap(layout, row);
|
||||
|
||||
// C/C++
|
||||
|
||||
addTitle("Python", layout, row);
|
||||
|
||||
m_pythonPostProcessing = addCheckBox("Post Processing",
|
||||
"Add ambiguous edges for unsolved references",
|
||||
"<p>Enable a post processing step to solve unsolved references after the indexing is done. </p>"
|
||||
"<p>These references will be marked \"ambiguous\" to indicate that some of these edges may never "
|
||||
"be encountered during runtime of the indexed code because the post processing only relies on "
|
||||
"symbol names and types.</p>",
|
||||
layout, row);
|
||||
|
||||
addGap(layout, row);
|
||||
|
||||
|
||||
addTitle("C/C++", layout, row);
|
||||
}
|
||||
|
||||
@@ -447,6 +460,8 @@ void QtProjectWizzardContentPreferences::load()
|
||||
{
|
||||
m_mavenPath->setText(QString::fromStdWString(appSettings->getMavenPath().wstr()));
|
||||
}
|
||||
|
||||
m_pythonPostProcessing->setChecked(appSettings->getPythonPostProcessingEnabled());
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentPreferences::save()
|
||||
@@ -510,6 +525,8 @@ void QtProjectWizzardContentPreferences::save()
|
||||
appSettings->setMavenPath(FilePath(m_mavenPath->getText().toStdWString()));
|
||||
}
|
||||
|
||||
appSettings->setPythonPostProcessingEnabled(m_pythonPostProcessing->isChecked());
|
||||
|
||||
appSettings->save();
|
||||
}
|
||||
|
||||
|
||||
@@ -125,6 +125,8 @@ private:
|
||||
QtPathListBox* m_jreSystemLibraryPaths;
|
||||
QLineEdit* m_jvmMaximumMemory;
|
||||
QtLocationPicker* m_mavenPath;
|
||||
|
||||
QCheckBox* m_pythonPostProcessing;
|
||||
};
|
||||
|
||||
#endif // QT_PROJECT_WIZZARD_CONTENT_PREFERENCES_H
|
||||
|
||||
Reference in New Issue
Block a user