mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-09 03:52:19 +02:00
Added IDE colorization: Member, Local, Parameter
This commit is contained in:
parent
ba436231cb
commit
2b9fa80b81
6 changed files with 74 additions and 7 deletions
|
@ -324,6 +324,9 @@ namespace IDE
|
|||
public Color mLiteral = 0XFFC8A0FF;
|
||||
public Color mIdentifier = 0xFFFFFFFF;
|
||||
public Color mComment = 0xFF75715E;
|
||||
public Color mLocal = 0xFFFFFFFF;
|
||||
public Color mParameter = 0xFFFFFFFF;
|
||||
public Color mMember = 0xFFFFFFFF;
|
||||
public Color mMethod = 0xFFA6E22A;
|
||||
public Color mType = 0xFF66D9EF;
|
||||
public Color mPrimitiveType = 0xFF66D9EF;
|
||||
|
@ -371,8 +374,15 @@ namespace IDE
|
|||
GetColor("Keyword", ref mKeyword);
|
||||
GetColor("Literal", ref mLiteral);
|
||||
GetColor("Identifier", ref mIdentifier);
|
||||
GetColor("Comment", ref mComment);
|
||||
mLocal = mIdentifier;
|
||||
mParameter = mIdentifier;
|
||||
GetColor("Local", ref mLocal);
|
||||
GetColor("Parameter", ref mParameter);
|
||||
mMember = mIdentifier;
|
||||
GetColor("Member", ref mMember);
|
||||
mMethod = mMember;
|
||||
GetColor("Method", ref mMethod);
|
||||
GetColor("Comment", ref mComment);
|
||||
if (sd.Contains("Type"))
|
||||
{
|
||||
GetColor("Type", ref mType);
|
||||
|
@ -409,8 +419,11 @@ namespace IDE
|
|||
SourceEditWidgetContent.sTextColors[(.)SourceElementType.Normal] = mCode;
|
||||
SourceEditWidgetContent.sTextColors[(.)SourceElementType.Keyword] = mKeyword;
|
||||
SourceEditWidgetContent.sTextColors[(.)SourceElementType.Literal] = mLiteral;
|
||||
SourceEditWidgetContent.sTextColors[(.)SourceElementType.Identifier] = mIdentifier;
|
||||
SourceEditWidgetContent.sTextColors[(.)SourceElementType.Comment] = mComment;
|
||||
SourceEditWidgetContent.sTextColors[(.)SourceElementType.Identifier] = mIdentifier;
|
||||
SourceEditWidgetContent.sTextColors[(.)SourceElementType.Local] = mLocal;
|
||||
SourceEditWidgetContent.sTextColors[(.)SourceElementType.Parameter] = mParameter;
|
||||
SourceEditWidgetContent.sTextColors[(.)SourceElementType.Member] = mMember;
|
||||
SourceEditWidgetContent.sTextColors[(.)SourceElementType.Method] = mMethod;
|
||||
SourceEditWidgetContent.sTextColors[(.)SourceElementType.Type] = mType;
|
||||
SourceEditWidgetContent.sTextColors[(.)SourceElementType.PrimitiveType] = mPrimitiveType;
|
||||
|
|
|
@ -785,8 +785,11 @@ namespace IDE.ui
|
|||
0xFFFFFFFF, // Normal
|
||||
0xFFE1AE9A, // Keyword
|
||||
0XFFC8A0FF, // Literal
|
||||
0xFFFFFFFF, // Identifier
|
||||
0xFF75715E, // Comment
|
||||
0xFFFFFFFF, // Identifier
|
||||
0xFFFFFFFF, // Local
|
||||
0xFFFFFFFF, // Parameter
|
||||
0xFFFFFFFF, // Member
|
||||
0xFFA6E22A, // Method
|
||||
0xFF66D9EF, // Type
|
||||
0xFF66D9EF, // PrimitiveType
|
||||
|
|
|
@ -26,8 +26,11 @@ namespace IDE.ui
|
|||
Normal,
|
||||
Keyword,
|
||||
Literal,
|
||||
Identifier,
|
||||
Comment,
|
||||
Identifier,
|
||||
Local,
|
||||
Parameter,
|
||||
Member,
|
||||
Method,
|
||||
Type,
|
||||
PrimitiveType,
|
||||
|
|
|
@ -4464,6 +4464,8 @@ BfTypedValue BfExprEvaluator::LookupIdentifier(BfAstNode* refNode, const StringI
|
|||
}
|
||||
}
|
||||
|
||||
mModule->SetElementType(identifierNode, (varDecl->IsParam()) ? BfSourceElementType_Parameter : BfSourceElementType_Local);
|
||||
|
||||
BfTypedValue localResult = LoadLocal(varDecl);
|
||||
auto autoComplete = GetAutoComplete();
|
||||
if (identifierNode != NULL)
|
||||
|
@ -4517,6 +4519,8 @@ BfTypedValue BfExprEvaluator::LookupIdentifier(BfAstNode* refNode, const StringI
|
|||
else if (fieldDef->mIsReadOnly)
|
||||
result = mModule->LoadValue(result);
|
||||
|
||||
//mModule->SetElementType(identifierNode, (localVar->IsParam()) ? BfSourceElementType_Parameter : BfSourceElementType_Local);
|
||||
|
||||
mResultLocalVar = localVar;
|
||||
mResultFieldInstance = &field;
|
||||
mResultLocalVarField = -(field.mMergedDataIdx + 1);
|
||||
|
@ -4676,9 +4680,12 @@ BfTypedValue BfExprEvaluator::LookupIdentifier(BfAstNode* refNode, const StringI
|
|||
thisValue = BfTypedValue(globalContainer.mTypeInst);
|
||||
result = LookupField(identifierNode, thisValue, findName);
|
||||
if ((result) || (mPropDef != NULL))
|
||||
{
|
||||
mModule->SetElementType(identifierNode, BfSourceElementType_Member);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
auto staticSearch = mModule->GetStaticSearch();
|
||||
if (staticSearch != NULL)
|
||||
|
@ -4688,10 +4695,17 @@ BfTypedValue BfExprEvaluator::LookupIdentifier(BfAstNode* refNode, const StringI
|
|||
thisValue = BfTypedValue(typeInst);
|
||||
result = LookupField(identifierNode, thisValue, findName);
|
||||
if ((result) || (mPropDef != NULL))
|
||||
{
|
||||
mModule->SetElementType(identifierNode, BfSourceElementType_Member);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mModule->SetElementType(identifierNode, BfSourceElementType_Member);
|
||||
}
|
||||
|
||||
if ((!result) && (identifierNode != NULL))
|
||||
{
|
||||
|
|
|
@ -159,6 +159,7 @@ void BfSourceClassifier::Visit(BfFieldDeclaration* fieldDecl)
|
|||
VisitChild(fieldDecl->mReadOnlySpecifier);
|
||||
VisitChild(fieldDecl->mTypeRef);
|
||||
VisitChild(fieldDecl->mNameNode);
|
||||
SetElementType(fieldDecl->mNameNode, BfSourceElementType_Member);
|
||||
}
|
||||
|
||||
void BfSourceClassifier::Visit(BfFieldDtorDeclaration* fieldDtorDecl)
|
||||
|
@ -285,6 +286,8 @@ void BfSourceClassifier::Visit(BfQualifiedNameNode* qualifiedName)
|
|||
VisitChild(qualifiedName->mLeft);
|
||||
VisitChild(qualifiedName->mDot);
|
||||
VisitChild(qualifiedName->mRight);
|
||||
if (BfNodeIsExact<BfIdentifierNode>(qualifiedName->mRight))
|
||||
SetElementType(qualifiedName->mRight, BfSourceElementType_Member);
|
||||
}
|
||||
|
||||
void BfSourceClassifier::Visit(BfThisExpression* thisExpr)
|
||||
|
@ -306,7 +309,7 @@ void BfSourceClassifier::Visit(BfMemberReferenceExpression* memberRefExpr)
|
|||
Visit((BfAstNode*)memberRefExpr);
|
||||
VisitChild(memberRefExpr->mTarget);
|
||||
VisitChild(memberRefExpr->mDotToken);
|
||||
VisitChild(memberRefExpr->mMemberName);
|
||||
SetElementType(memberRefExpr->mMemberName, BfSourceElementType_Member);
|
||||
}
|
||||
|
||||
void BfSourceClassifier::Visit(BfNamedTypeReference* typeRef)
|
||||
|
@ -395,6 +398,24 @@ void BfSourceClassifier::Visit(BfGenericInstanceTypeRef* genericInstTypeRef)
|
|||
VisitChild(genericInstTypeRef->mCloseChevron);
|
||||
}
|
||||
|
||||
void BfSourceClassifier::Visit(BfVariableDeclaration* varDecl)
|
||||
{
|
||||
BfElementVisitor::Visit(varDecl);
|
||||
|
||||
if (!varDecl->IsA<BfParameterDeclaration>())
|
||||
SetElementType(varDecl->mNameNode, BfSourceElementType_Local);
|
||||
}
|
||||
|
||||
void BfSourceClassifier::Visit(BfLambdaBindExpression* lambdaBindExpr)
|
||||
{
|
||||
BfElementVisitor::Visit(lambdaBindExpr);
|
||||
|
||||
for (auto param : lambdaBindExpr->mParams)
|
||||
{
|
||||
SetElementType(param, BfSourceElementType_Parameter);
|
||||
}
|
||||
}
|
||||
|
||||
void BfSourceClassifier::Visit(BfLocalMethodDeclaration* methodDecl)
|
||||
{
|
||||
if (IsInterestedInMember(methodDecl, true))
|
||||
|
@ -573,6 +594,12 @@ void BfSourceClassifier::Visit(BfMethodDeclaration* methodDeclaration)
|
|||
|
||||
SetElementType(methodDeclaration->mNameNode, BfSourceElementType_Method);
|
||||
|
||||
for (auto paramDecl : methodDeclaration->mParams)
|
||||
{
|
||||
if (paramDecl != NULL)
|
||||
SetElementType(paramDecl->mNameNode, BfSourceElementType_Parameter);
|
||||
}
|
||||
|
||||
if (methodDeclaration->mGenericParams != NULL)
|
||||
{
|
||||
for (auto& genericParam : methodDeclaration->mGenericParams->mGenericParams)
|
||||
|
@ -615,6 +642,8 @@ void BfSourceClassifier::Visit(BfPropertyDeclaration* propertyDeclaration)
|
|||
|
||||
BfElementVisitor::Visit(propertyDeclaration);
|
||||
|
||||
SetElementType(propertyDeclaration->mNameNode, BfSourceElementType_Member);
|
||||
|
||||
if (auto expr = BfNodeDynCast<BfPropertyBodyExpression>(propertyDeclaration->mDefinitionBlock))
|
||||
return;
|
||||
|
||||
|
|
|
@ -12,8 +12,11 @@ enum BfSourceElementType
|
|||
BfSourceElementType_Normal,
|
||||
BfSourceElementType_Keyword,
|
||||
BfSourceElementType_Literal,
|
||||
BfSourceElementType_Identifier,
|
||||
BfSourceElementType_Comment,
|
||||
BfSourceElementType_Identifier,
|
||||
BfSourceElementType_Local,
|
||||
BfSourceElementType_Parameter,
|
||||
BfSourceElementType_Member,
|
||||
BfSourceElementType_Method,
|
||||
BfSourceElementType_Type,
|
||||
BfSourceElementType_PrimitiveType,
|
||||
|
@ -115,7 +118,9 @@ public:
|
|||
virtual void Visit(BfNamedTypeReference* typeRef) override;
|
||||
virtual void Visit(BfTagTypeRef* typeRef) override;
|
||||
virtual void Visit(BfGenericInstanceTypeRef* typeRef) override;
|
||||
virtual void Visit(BfLocalMethodDeclaration * methodDecl) override;
|
||||
virtual void Visit(BfVariableDeclaration* varDecl) override;
|
||||
virtual void Visit(BfLambdaBindExpression* lambdaBindExpr) override;
|
||||
virtual void Visit(BfLocalMethodDeclaration* methodDecl) override;
|
||||
virtual void Visit(BfLiteralExpression* literalExpr) override;
|
||||
virtual void Visit(BfStringInterpolationExpression* stringInterpolationExpression) override;
|
||||
virtual void Visit(BfTokenNode* tokenNode) override;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue