1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 20:42:21 +02:00

Fixed extension methods in autocomplete, added extmethod icon

This commit is contained in:
Brian Fiete 2021-01-20 12:43:55 -08:00
parent 3f35ef51f2
commit 3560554127
7 changed files with 15 additions and 5 deletions

View file

@ -180,6 +180,8 @@ namespace Beefy.theme.dark
ComboBoxFrameless,
PanelHeader,
ExtMethod,
COUNT
};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 50 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 88 KiB

After

Width:  |  Height:  |  Size: 89 KiB

Before After
Before After

Binary file not shown.

View file

@ -2015,6 +2015,8 @@ namespace IDE.ui
{
case "method":
entryIcon = DarkTheme.sDarkTheme.GetImage(.Method);
case "extmethod":
entryIcon = DarkTheme.sDarkTheme.GetImage(.ExtMethod);
case "field":
entryIcon = DarkTheme.sDarkTheme.GetImage(.Field);
case "property":

View file

@ -467,6 +467,9 @@ void BfAutoComplete::AddMethod(BfTypeInstance* typeInstance, BfMethodDef* method
entry.mEntryType = "mixin";
}
}
if (methodDef->mMethodType == BfMethodType_Extension)
entry.mEntryType = "extmethod";
if (auto entryAdded = AddEntry(entry, filter))
{
if (methodDecl != NULL)
@ -1112,6 +1115,7 @@ void BfAutoComplete::AddExtensionMethods(BfTypeInstance* targetType, BfTypeInsta
if (!genericInferContext.InferGenericArgument(methodInstance, targetType, thisType, BfIRValue()))
continue;
genericInferContext.InferGenericArguments(methodInstance);
thisType = mModule->ResolveGenericType(thisType, NULL, &genericTypeVector, false);
if (thisType == NULL)
@ -1419,7 +1423,8 @@ void BfAutoComplete::CheckIdentifier(BfAstNode* identifierNode, bool isInExpress
mModule->PopulateGlobalContainersList(globalLookup);
for (auto& globalContainer : mModule->mContext->mCurTypeState->mGlobalContainers)
{
AddTypeMembers(globalContainer.mTypeInst, true, false, filter, globalContainer.mTypeInst, true, true, false);
if (globalContainer.mTypeInst != NULL)
AddTypeMembers(globalContainer.mTypeInst, true, false, filter, globalContainer.mTypeInst, true, true, false);
}
}
@ -1766,11 +1771,11 @@ bool BfAutoComplete::CheckMemberReference(BfAstNode* target, BfAstNode* dotToken
AddTypeMembers(typeInst, isStatic, !isStatic, filter, typeInst, false, false, false);
if (!isStatic)
{
{
auto checkTypeInst = mModule->mCurTypeInstance;
while (checkTypeInst != NULL)
{
AddExtensionMethods(typeInst, checkTypeInst, filter, allowProtected, allowPrivate);
AddExtensionMethods(typeInst, checkTypeInst, filter, true, true);
checkTypeInst = mModule->GetOuterType(checkTypeInst);
}
@ -1781,8 +1786,9 @@ bool BfAutoComplete::CheckMemberReference(BfAstNode* target, BfAstNode* dotToken
BfGlobalLookup globalLookup;
globalLookup.mKind = BfGlobalLookup::Kind_All;
mModule->PopulateGlobalContainersList(globalLookup);
for (auto& globalContainer : mModule->mContext->mCurTypeState->mGlobalContainers)
AddExtensionMethods(typeInst, globalContainer.mTypeInst, filter, false, false);
for (auto& globalContainer : mModule->mContext->mCurTypeState->mGlobalContainers)
if (globalContainer.mTypeInst != NULL)
AddExtensionMethods(typeInst, globalContainer.mTypeInst, filter, false, false);
}
BfStaticSearch* staticSearch = mModule->GetStaticSearch();