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