mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 19:48:20 +02:00
Extended autocomplete info
This commit is contained in:
parent
080a5483ae
commit
b28a87136f
9 changed files with 270 additions and 111 deletions
|
@ -241,6 +241,13 @@ public:
|
|||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
char* AllocString(const StringImpl& str)
|
||||
{
|
||||
char* ptr = (char*)AllocBytes(str.length() + 1);
|
||||
memcpy(ptr, str.c_str(), str.length() + 1);
|
||||
return ptr;
|
||||
}
|
||||
};
|
||||
|
||||
class BumpAllocator : public BumpAllocatorT<0x2000>
|
||||
|
|
|
@ -82,6 +82,16 @@ namespace IDE.ui
|
|||
continue;
|
||||
}
|
||||
|
||||
if (c == '\x04')
|
||||
{
|
||||
queuedSpace = false;
|
||||
atLineStart = true;
|
||||
lineHadStar = false;
|
||||
lineHadContent = false;
|
||||
mDocString.Append('\n');
|
||||
continue;
|
||||
}
|
||||
|
||||
if (atLineStart)
|
||||
{
|
||||
if ((c == '*') && (blockDepth > 0) && (!lineHadStar))
|
||||
|
@ -498,14 +508,21 @@ namespace IDE.ui
|
|||
{
|
||||
DocumentationParser docParser = scope DocumentationParser(selectedEntry.mDocumentation);
|
||||
var showDocString = docParser.ShowDocString;
|
||||
docWidth = font.GetWidth(showDocString) + GS!(24);
|
||||
|
||||
int lineCount = 0;
|
||||
docWidth = 0;
|
||||
for (var line in showDocString.Split('\n'))
|
||||
{
|
||||
docWidth = Math.Max(docWidth, font.GetWidth(line) + GS!(24));
|
||||
lineCount++;
|
||||
}
|
||||
|
||||
int drawScreenX = (.)(mWidgetWindow.mX + mWidth - mDocWidth);
|
||||
gApp.GetWorkspaceRectFrom(drawScreenX, mWidgetWindow.mY, 0, 0, var workspaceX, var workspaceY, var workspaceWidth, var workspaceHeight);
|
||||
float maxWidth = workspaceWidth - drawScreenX - GS!(8);
|
||||
float newDocWidth = Math.Min(docWidth, workspaceWidth - drawScreenX - GS!(8));
|
||||
newDocWidth = Math.Max(newDocWidth, GS!(80));
|
||||
if (docWidth > maxWidth)
|
||||
if ((docWidth > maxWidth) || (lineCount > 1))
|
||||
{
|
||||
docWidth = newDocWidth;
|
||||
docHeight = font.GetWrapHeight(showDocString, docWidth - GS!(20)) + GS!(17);
|
||||
|
@ -693,8 +710,6 @@ namespace IDE.ui
|
|||
//float drawHeight = GS!(32);
|
||||
float drawHeight = mDocHeight;
|
||||
|
||||
|
||||
|
||||
using (g.PushColor(0x80000000))
|
||||
g.DrawBox(DarkTheme.sDarkTheme.GetImage(.DropShadow), drawX + GS!(2), drawY + GS!(2), mRightBoxAdjust - GS!(2), drawHeight - GS!(2));
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "BfSourceClassifier.h"
|
||||
#include "BfResolvePass.h"
|
||||
#include "BfFixits.h"
|
||||
#include "BfResolvedTypeUtils.h"
|
||||
|
||||
#pragma warning(disable:4996)
|
||||
|
||||
|
@ -452,7 +453,7 @@ bool BfAutoComplete::IsAttribute(BfTypeInstance* typeInst)
|
|||
return false;
|
||||
}
|
||||
|
||||
void BfAutoComplete::AddMethod(BfMethodDeclaration* methodDecl, const StringImpl& methodName, const StringImpl& filter)
|
||||
void BfAutoComplete::AddMethod(BfTypeInstance* typeInstance, BfMethodDef* methodDef, BfMethodInstance* methodInstance, BfMethodDeclaration* methodDecl, const StringImpl& methodName, const StringImpl& filter)
|
||||
{
|
||||
String replaceName;
|
||||
AutoCompleteEntry entry("method", methodName);
|
||||
|
@ -464,11 +465,31 @@ void BfAutoComplete::AddMethod(BfMethodDeclaration* methodDecl, const StringImpl
|
|||
replaceName += "!";
|
||||
entry.mDisplay = replaceName.c_str();
|
||||
entry.mEntryType = "mixin";
|
||||
}
|
||||
entry.mDocumentation = methodDecl->mDocumentation;
|
||||
}
|
||||
if (AddEntry(entry, filter) != NULL)
|
||||
}
|
||||
}
|
||||
if (auto entryAdded = AddEntry(entry, filter))
|
||||
{
|
||||
if (methodDecl != NULL)
|
||||
{
|
||||
if (CheckDocumentation(entryAdded, NULL))
|
||||
{
|
||||
String str;
|
||||
if ((methodInstance == NULL) && (methodDef != NULL))
|
||||
methodInstance = mModule->GetRawMethodInstance(typeInstance, methodDef);
|
||||
if (methodInstance != NULL)
|
||||
str = mModule->MethodToString(methodInstance, BfMethodNameFlag_IncludeReturnType);
|
||||
|
||||
if (methodDecl->mDocumentation != NULL)
|
||||
{
|
||||
if (!str.IsEmpty())
|
||||
str += "\x04";
|
||||
methodDecl->mDocumentation->GetDocString(str);
|
||||
}
|
||||
if (!str.IsEmpty())
|
||||
entryAdded->mDocumentation = mAlloc.AllocString(str);
|
||||
}
|
||||
}
|
||||
|
||||
if ((mResolveType == BfResolveType_GoToDefinition) && (mGetDefinitionNode == NULL) && (methodDecl->mNameNode != NULL))
|
||||
SetDefinitionLocation(methodDecl->mNameNode);
|
||||
}
|
||||
|
@ -516,15 +537,28 @@ void BfAutoComplete::AddTypeDef(BfTypeDef* typeDef, const StringImpl& filter, bo
|
|||
|
||||
AutoCompleteEntry* entryAdded = NULL;
|
||||
if (typeDef->mTypeCode == BfTypeCode_Object)
|
||||
entryAdded = AddEntry(AutoCompleteEntry("class", name, typeDef->mTypeDeclaration->mDocumentation), filter);
|
||||
entryAdded = AddEntry(AutoCompleteEntry("class", name), filter);
|
||||
else if (typeDef->mTypeCode == BfTypeCode_Interface)
|
||||
entryAdded = AddEntry(AutoCompleteEntry("interface", name, typeDef->mTypeDeclaration->mDocumentation), filter);
|
||||
entryAdded = AddEntry(AutoCompleteEntry("interface", name), filter);
|
||||
else
|
||||
entryAdded = AddEntry(AutoCompleteEntry("valuetype", name, typeDef->mTypeDeclaration->mDocumentation), filter);
|
||||
entryAdded = AddEntry(AutoCompleteEntry("valuetype", name), filter);
|
||||
|
||||
if ((entryAdded != NULL) && (mIsGetDefinition))
|
||||
if (entryAdded != NULL)
|
||||
{
|
||||
|
||||
if (CheckDocumentation(entryAdded, NULL))
|
||||
{
|
||||
auto typeInst = mModule->ResolveTypeDef(typeDef, BfPopulateType_IdentityNoRemapAlias);
|
||||
String str;
|
||||
if (typeInst != NULL)
|
||||
str = mModule->TypeToString(typeInst, BfTypeNameFlag_ExtendedInfo);
|
||||
if (typeDef->mTypeDeclaration->mDocumentation != NULL)
|
||||
{
|
||||
if (!str.IsEmpty())
|
||||
str += "\x04";
|
||||
typeDef->mTypeDeclaration->mDocumentation->GetDocString(str);
|
||||
}
|
||||
entryAdded->mDocumentation = mAlloc.AllocString(str);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -589,6 +623,94 @@ void BfAutoComplete::AddCurrentTypes(BfTypeInstance* typeInst, const StringImpl&
|
|||
AddCurrentTypes(baseType, filter, allowProtected, allowPrivate, onlyAttribute);
|
||||
}
|
||||
|
||||
void BfAutoComplete::AddField(BfTypeInstance* typeInst, BfFieldDef* fieldDef, BfFieldInstance* fieldInstance, const StringImpl& filter)
|
||||
{
|
||||
AutoCompleteEntry entry(GetTypeName(fieldInstance->mResolvedType), fieldDef->mName);
|
||||
if (auto entryAdded = AddEntry(entry, filter))
|
||||
{
|
||||
auto documentation = (fieldDef->mFieldDeclaration != NULL) ? fieldDef->mFieldDeclaration->mDocumentation : NULL;
|
||||
if (CheckDocumentation(entryAdded, documentation))
|
||||
{
|
||||
mModule->PopulateType(typeInst);
|
||||
|
||||
String str;
|
||||
str += mModule->TypeToString(fieldInstance->mResolvedType);
|
||||
str += " ";
|
||||
str += mModule->TypeToString(typeInst);
|
||||
str += ".";
|
||||
str += fieldDef->mName;
|
||||
if (documentation != NULL)
|
||||
{
|
||||
str += "\x04";
|
||||
documentation->GetDocString(str);
|
||||
}
|
||||
entryAdded->mDocumentation = mAlloc.AllocString(str);
|
||||
}
|
||||
|
||||
if ((mIsGetDefinition) && (mDefType == NULL))
|
||||
{
|
||||
mDefType = typeInst->mTypeDef;
|
||||
mDefField = fieldDef;
|
||||
if (fieldDef->mFieldDeclaration != NULL)
|
||||
SetDefinitionLocation(fieldDef->mFieldDeclaration->mNameNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BfAutoComplete::AddProp(BfTypeInstance* typeInst, BfPropertyDef* propDef, const StringImpl& filter)
|
||||
{
|
||||
BfCommentNode* documentation = NULL;
|
||||
if (propDef->mFieldDeclaration != NULL)
|
||||
documentation = propDef->mFieldDeclaration->mDocumentation;
|
||||
AutoCompleteEntry entry("property", propDef->mName);
|
||||
if (auto entryAdded = AddEntry(entry, filter))
|
||||
{
|
||||
if (CheckDocumentation(entryAdded, documentation))
|
||||
{
|
||||
BfType* propType = NULL;
|
||||
|
||||
for (auto methodDef : propDef->mMethods)
|
||||
{
|
||||
auto methodInstance = mModule->GetRawMethodInstance(typeInst, methodDef);
|
||||
if (methodInstance == NULL)
|
||||
continue;
|
||||
if (methodDef->mMethodType == BfMethodType_PropertyGetter)
|
||||
{
|
||||
propType = methodInstance->mReturnType;
|
||||
break;
|
||||
}
|
||||
if (methodDef->mMethodType == BfMethodType_PropertySetter)
|
||||
{
|
||||
if (methodInstance->GetParamCount() > 0)
|
||||
{
|
||||
propType = methodInstance->GetParamType(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String str;
|
||||
if (propType != NULL)
|
||||
{
|
||||
str += mModule->TypeToString(propType);
|
||||
str += " ";
|
||||
}
|
||||
|
||||
str += mModule->TypeToString(typeInst);
|
||||
str += ".";
|
||||
str += propDef->mName;
|
||||
if (documentation != NULL)
|
||||
{
|
||||
str += "\x04";
|
||||
documentation->GetDocString(str);
|
||||
}
|
||||
entryAdded->mDocumentation = mAlloc.AllocString(str);
|
||||
}
|
||||
if ((mIsGetDefinition) && (propDef->mFieldDeclaration != NULL))
|
||||
SetDefinitionLocation(propDef->mFieldDeclaration->mNameNode);
|
||||
}
|
||||
}
|
||||
|
||||
void BfAutoComplete::AddTypeMembers(BfTypeInstance* typeInst, bool addStatic, bool addNonStatic, const StringImpl& filter, BfTypeInstance* startType, bool allowInterfaces, bool allowImplicitThis)
|
||||
{
|
||||
bool isInterface = false;
|
||||
|
@ -624,17 +746,7 @@ void BfAutoComplete::AddTypeMembers(BfTypeInstance* typeInst, bool addStatic, bo
|
|||
(!typeInst->IsTypeMemberAccessible(fieldDef->mDeclaringType, activeTypeDef)))
|
||||
continue;
|
||||
|
||||
AutoCompleteEntry entry(GetTypeName(fieldInst.mResolvedType), fieldDef->mName, (fieldDef->mFieldDeclaration != NULL) ? fieldDef->mFieldDeclaration->mDocumentation : NULL);
|
||||
if ((AddEntry(entry, filter)) && (mIsGetDefinition))
|
||||
{
|
||||
if (mDefType == NULL)
|
||||
{
|
||||
mDefType = typeInst->mTypeDef;
|
||||
mDefField = fieldDef;
|
||||
if (fieldDef->mFieldDeclaration != NULL)
|
||||
SetDefinitionLocation(fieldDef->mFieldDeclaration->mNameNode);
|
||||
}
|
||||
}
|
||||
AddField(typeInst, fieldDef, &fieldInst, filter);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -667,7 +779,7 @@ void BfAutoComplete::AddTypeMembers(BfTypeInstance* typeInst, bool addStatic, bo
|
|||
}
|
||||
if (canUseMethod)
|
||||
{
|
||||
AddMethod(methodDef->GetMethodDeclaration(), methodDef->mName, filter);
|
||||
AddMethod(typeInst, methodDef, NULL, methodDef->GetMethodDeclaration(), methodDef->mName, filter);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -687,15 +799,7 @@ void BfAutoComplete::AddTypeMembers(BfTypeInstance* typeInst, bool addStatic, bo
|
|||
if (propDef->mName == "[]")
|
||||
continue;
|
||||
|
||||
BfCommentNode* documentation = NULL;
|
||||
if (propDef->mFieldDeclaration != NULL)
|
||||
documentation = propDef->mFieldDeclaration->mDocumentation;
|
||||
AutoCompleteEntry entry("property", propDef->mName, documentation);
|
||||
if (AddEntry(entry, filter))
|
||||
{
|
||||
if ((mIsGetDefinition) && (propDef->mFieldDeclaration != NULL))
|
||||
SetDefinitionLocation(propDef->mFieldDeclaration->mNameNode);
|
||||
}
|
||||
AddProp(typeInst, propDef, filter);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -750,17 +854,7 @@ void BfAutoComplete::AddSelfResultTypeMembers(BfTypeInstance* typeInst, BfTypeIn
|
|||
(!typeInst->IsTypeMemberAccessible(fieldDef->mDeclaringType, activeTypeDef)))
|
||||
continue;
|
||||
|
||||
AutoCompleteEntry entry(GetTypeName(fieldInst.mResolvedType), fieldDef->mName, fieldDef->mFieldDeclaration->mDocumentation);
|
||||
if ((AddEntry(entry, filter)) && (mIsGetDefinition))
|
||||
{
|
||||
if (mDefType == NULL)
|
||||
{
|
||||
mDefType = typeInst->mTypeDef;
|
||||
mDefField = fieldDef;
|
||||
if (fieldDef->mFieldDeclaration != NULL)
|
||||
SetDefinitionLocation(fieldDef->mFieldDeclaration->mNameNode);
|
||||
}
|
||||
}
|
||||
AddField(typeInst, fieldDef, &fieldInst, filter);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -798,15 +892,10 @@ void BfAutoComplete::AddSelfResultTypeMembers(BfTypeInstance* typeInst, BfTypeIn
|
|||
continue;
|
||||
|
||||
if (canUseMethod)
|
||||
{
|
||||
{
|
||||
if (auto methodDeclaration = methodDef->GetMethodDeclaration())
|
||||
{
|
||||
String replaceName;
|
||||
AutoCompleteEntry entry("method", methodDef->mName, methodDeclaration->mDocumentation);
|
||||
if ((AddEntry(entry, filter)) && (mIsGetDefinition))
|
||||
{
|
||||
|
||||
}
|
||||
AddMethod(typeInst, methodDef, NULL, methodDeclaration, methodDef->mName, filter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -848,9 +937,8 @@ void BfAutoComplete::AddSelfResultTypeMembers(BfTypeInstance* typeInst, BfTypeIn
|
|||
continue;
|
||||
if (propDef->mName == "[]")
|
||||
continue;
|
||||
AutoCompleteEntry entry("property", propDef->mName, propDef->mFieldDeclaration->mDocumentation);
|
||||
if ((AddEntry(entry, filter)) && (mIsGetDefinition))
|
||||
SetDefinitionLocation(propDef->mFieldDeclaration->mNameNode);
|
||||
|
||||
AddProp(typeInst, propDef, filter);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -917,13 +1005,20 @@ void BfAutoComplete::AddEnumTypeMembers(BfTypeInstance* typeInst, const StringIm
|
|||
hasPayload = true;
|
||||
}
|
||||
|
||||
AutoCompleteEntry entry(hasPayload ? "payloadEnum" : "value", fieldDef->mName, fieldDef->mFieldDeclaration->mDocumentation);
|
||||
if ((AddEntry(entry, filter)) && (mIsGetDefinition))
|
||||
AutoCompleteEntry entry(hasPayload ? "payloadEnum" : "value", fieldDef->mName);
|
||||
if (auto entryAdded = AddEntry(entry, filter))
|
||||
{
|
||||
mDefType = typeInst->mTypeDef;
|
||||
mDefField = fieldDef;
|
||||
if (fieldDef->mFieldDeclaration != NULL)
|
||||
SetDefinitionLocation(fieldDef->mFieldDeclaration->mNameNode);
|
||||
if (CheckDocumentation(entryAdded, fieldDef->mFieldDeclaration->mDocumentation))
|
||||
{
|
||||
}
|
||||
|
||||
if (mIsGetDefinition)
|
||||
{
|
||||
mDefType = typeInst->mTypeDef;
|
||||
mDefField = fieldDef;
|
||||
if (fieldDef->mFieldDeclaration != NULL)
|
||||
SetDefinitionLocation(fieldDef->mFieldDeclaration->mNameNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1018,11 +1113,7 @@ void BfAutoComplete::AddExtensionMethods(BfTypeInstance* targetType, BfTypeInsta
|
|||
{
|
||||
if (auto methodDeclaration = methodDef->GetMethodDeclaration())
|
||||
{
|
||||
String replaceName;
|
||||
AutoCompleteEntry entry("method", methodDef->mName, methodDeclaration->mDocumentation);
|
||||
if ((AddEntry(entry)) && (mIsGetDefinition))
|
||||
{
|
||||
}
|
||||
AddMethod(extensionContainer, methodDef, NULL, methodDeclaration, methodDef->mName, filter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1261,17 +1352,27 @@ void BfAutoComplete::CheckIdentifier(BfAstNode* identifierNode, bool isInExpress
|
|||
auto showAttrTypeDef = mShowAttributeProperties->mTypeDef;
|
||||
for (auto prop : showAttrTypeDef->mProperties)
|
||||
{
|
||||
if ((AddEntry(AutoCompleteEntry("property", prop->mName + "=", prop->mFieldDeclaration->mDocumentation), filter)) && (mIsGetDefinition))
|
||||
{
|
||||
SetDefinitionLocation(prop->mFieldDeclaration->mNameNode);
|
||||
if (auto entryAdded = AddEntry(AutoCompleteEntry("property", prop->mName + "="), filter))
|
||||
{
|
||||
if (CheckDocumentation(entryAdded, prop->mFieldDeclaration->mDocumentation))
|
||||
{
|
||||
|
||||
}
|
||||
if (mIsGetDefinition)
|
||||
SetDefinitionLocation(prop->mFieldDeclaration->mNameNode);
|
||||
}
|
||||
}
|
||||
|
||||
for (auto field : showAttrTypeDef->mFields)
|
||||
{
|
||||
if ((AddEntry(AutoCompleteEntry("field", field->mName + "=", field->mFieldDeclaration->mDocumentation), filter)) && (mIsGetDefinition))
|
||||
{
|
||||
SetDefinitionLocation(field->mFieldDeclaration->mNameNode);
|
||||
if (auto entryAdded = AddEntry(AutoCompleteEntry("field", field->mName + "="), filter))
|
||||
{
|
||||
if (CheckDocumentation(entryAdded, field->mFieldDeclaration->mDocumentation))
|
||||
{
|
||||
|
||||
}
|
||||
if (mIsGetDefinition)
|
||||
SetDefinitionLocation(field->mFieldDeclaration->mNameNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1402,9 +1503,8 @@ void BfAutoComplete::CheckIdentifier(BfAstNode* identifierNode, bool isInExpress
|
|||
while (checkMethodState != NULL)
|
||||
{
|
||||
for (auto localMethod : checkMethodState->mLocalMethods)
|
||||
{
|
||||
//AddEntry(AutoCompleteEntry("method", localMethod->mMethodName, localMethod->mMethodDeclaration->mDocumentation), filter);
|
||||
AddMethod(localMethod->mMethodDeclaration, localMethod->mMethodName, filter);
|
||||
{
|
||||
AddMethod(mModule->mCurTypeInstance, localMethod->mMethodDef, localMethod->mMethodInstanceGroup->mDefault, localMethod->mMethodDeclaration, localMethod->mMethodName, filter);
|
||||
}
|
||||
checkMethodState = checkMethodState->mPrevMethodState;
|
||||
}
|
||||
|
@ -1788,7 +1888,7 @@ bool BfAutoComplete::CheckExplicitInterface(BfTypeInstance* interfaceType, BfAst
|
|||
canUseMethod = (methodDef->mMethodType == BfMethodType_Normal);
|
||||
if (canUseMethod)
|
||||
{
|
||||
AddMethod(methodDef->GetMethodDeclaration(), methodDef->mName, filter);
|
||||
AddMethod(interfaceType, methodDef, NULL, methodDef->GetMethodDeclaration(), methodDef->mName, filter);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2281,7 +2381,7 @@ void BfAutoComplete::AddOverrides(const StringImpl& filter)
|
|||
GetMethodInfo(methodInst, &insertString, &insertString, true, false);
|
||||
if (insertString.IsEmpty())
|
||||
continue;
|
||||
AddEntry(AutoCompleteEntry("override", insertString, NULL), filter);
|
||||
AddEntry(AutoCompleteEntry("override", insertString), filter);
|
||||
}
|
||||
|
||||
if (curType->IsStruct())
|
||||
|
@ -2687,9 +2787,22 @@ void BfAutoComplete::AddTypeInstanceEntry(BfTypeInstance* typeInst)
|
|||
mDefaultSelection = bestTypeName;
|
||||
}
|
||||
|
||||
void BfAutoComplete::CheckDocumentation(AutoCompleteEntry* entry, BfCommentNode* documentation)
|
||||
bool BfAutoComplete::CheckDocumentation(AutoCompleteEntry* entry, BfCommentNode* documentation)
|
||||
{
|
||||
if (mDocumentationEntryName.IsEmpty())
|
||||
return false;
|
||||
|
||||
if (mDocumentationEntryName != entry->mDisplay)
|
||||
return false;
|
||||
|
||||
if (documentation != NULL)
|
||||
{
|
||||
StringT<128> str;
|
||||
documentation->GetDocString(str);
|
||||
entry->mDocumentation = mAlloc.AllocString(str);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void BfAutoComplete::CheckEmptyStart(BfAstNode* prevNode, BfType* type)
|
||||
|
|
|
@ -14,7 +14,7 @@ class AutoCompleteEntry
|
|||
public:
|
||||
const char* mEntryType;
|
||||
const char* mDisplay;
|
||||
BfCommentNode* mDocumentation;
|
||||
const char* mDocumentation;
|
||||
|
||||
public:
|
||||
AutoCompleteEntry()
|
||||
|
@ -28,27 +28,13 @@ public:
|
|||
mDocumentation = NULL;
|
||||
}
|
||||
|
||||
AutoCompleteEntry(const char* entryType, const char* display, BfCommentNode* documentation)
|
||||
{
|
||||
mEntryType = entryType;
|
||||
mDisplay = display;
|
||||
mDocumentation = documentation;
|
||||
}
|
||||
|
||||
AutoCompleteEntry(const char* entryType, const StringImpl& display)
|
||||
{
|
||||
mEntryType = entryType;
|
||||
mDisplay = display.c_str();
|
||||
mDocumentation = NULL;
|
||||
}
|
||||
|
||||
AutoCompleteEntry(const char* entryType, const StringImpl& display, BfCommentNode* documentation)
|
||||
{
|
||||
mEntryType = entryType;
|
||||
mDisplay = display.c_str();
|
||||
mDocumentation = documentation;
|
||||
}
|
||||
|
||||
|
||||
bool operator==(const AutoCompleteEntry& other) const
|
||||
{
|
||||
return strcmp(mDisplay, other.mDisplay) == 0;
|
||||
|
@ -203,7 +189,9 @@ public:
|
|||
BfTypedValue LookupTypeRefOrIdentifier(BfAstNode* node, bool* isStatic, BfEvalExprFlags evalExprFlags = BfEvalExprFlags_None, BfType* expectingType = NULL);
|
||||
void SetDefinitionLocation(BfAstNode* astNode, bool force = false);
|
||||
bool IsAttribute(BfTypeInstance* typeInst);
|
||||
void AddMethod(BfMethodDeclaration* methodDecl, const StringImpl& methodName, const StringImpl& filter);
|
||||
void AddMethod(BfTypeInstance* typeInstance, BfMethodDef* methodDef, BfMethodInstance* methodInstance, BfMethodDeclaration* methodDecl, const StringImpl& methodName, const StringImpl& filter);
|
||||
void AddField(BfTypeInstance* typeInst, BfFieldDef* fieldDef, BfFieldInstance* fieldInstance, const StringImpl& filter);
|
||||
void AddProp(BfTypeInstance* typeInst, BfPropertyDef* propDef, const StringImpl& filter);
|
||||
void AddTypeDef(BfTypeDef* typeDef, const StringImpl& filter, bool onlyAttribute = false);
|
||||
void AddInnerTypes(BfTypeInstance* typeInst, const StringImpl& filter, bool allowProtected, bool allowPrivate);
|
||||
void AddCurrentTypes(BfTypeInstance* typeInst, const StringImpl& filter, bool allowProtected, bool allowPrivate, bool onlyAttribute);
|
||||
|
@ -217,12 +205,12 @@ public:
|
|||
void AddOverrides(const StringImpl& filter);
|
||||
void UpdateReplaceData();
|
||||
void AddTypeInstanceEntry(BfTypeInstance* typeInst);
|
||||
void CheckDocumentation(AutoCompleteEntry* entry, BfCommentNode* documentation);
|
||||
bool CheckDocumentation(AutoCompleteEntry* entry, BfCommentNode* documentation);
|
||||
bool GetMethodInfo(BfMethodInstance* methodInst, StringImpl* methodName, StringImpl* insertString, bool isImplementing, bool isExplicitInterface);
|
||||
void FixitGetParamString(const BfTypeVector& paramTypes, StringImpl& outStr);
|
||||
int FixitGetMemberInsertPos(BfTypeDef* typeDef);
|
||||
String FixitGetLocation(BfParserData* parserData, int insertPos);
|
||||
String ConstantToString(BfIRConstHolder* constHolder, BfIRValue id);
|
||||
String ConstantToString(BfIRConstHolder* constHolder, BfIRValue id);
|
||||
|
||||
public:
|
||||
BfAutoComplete(BfResolveType resolveType = BfResolveType_Autocomplete);
|
||||
|
|
|
@ -7674,12 +7674,10 @@ void BfCompiler::GenerateAutocompleteInfo()
|
|||
autoCompleteResultString += "\t";
|
||||
autoCompleteResultString += String(entry->mDisplay);
|
||||
|
||||
if ((entry->mDocumentation != NULL) && (wantsDocEntry != NULL) && (strcmp(wantsDocEntry, entry->mDisplay) == 0))
|
||||
{
|
||||
docString.Clear();
|
||||
entry->mDocumentation->GetDocString(docString);
|
||||
if (entry->mDocumentation != NULL)
|
||||
{
|
||||
autoCompleteResultString += '\x03';
|
||||
autoCompleteResultString += docString;
|
||||
autoCompleteResultString += entry->mDocumentation;
|
||||
}
|
||||
|
||||
autoCompleteResultString += "\n";
|
||||
|
|
|
@ -9838,7 +9838,7 @@ bool BfModule::HasMixin(BfTypeInstance* typeInstance, const StringImpl& methodNa
|
|||
return BfModuleMethodInstance();
|
||||
}
|
||||
|
||||
String BfModule::MethodToString(BfMethodInstance* methodInst, BfMethodNameFlags methodNameFlags, BfTypeVector* methodGenericArgs)
|
||||
StringT<128> BfModule::MethodToString(BfMethodInstance* methodInst, BfMethodNameFlags methodNameFlags, BfTypeVector* methodGenericArgs)
|
||||
{
|
||||
auto methodDef = methodInst->mMethodDef;
|
||||
bool allowResolveGenericParamNames = ((methodNameFlags & BfMethodNameFlag_ResolveGenericParamNames) != 0);
|
||||
|
@ -9852,8 +9852,15 @@ String BfModule::MethodToString(BfMethodInstance* methodInst, BfMethodNameFlags
|
|||
typeNameFlags = BfTypeNameFlag_ResolveGenericParamNames;
|
||||
if (allowResolveGenericParamNames)
|
||||
typeNameFlags = BfTypeNameFlag_ResolveGenericParamNames;
|
||||
|
||||
StringT<128> methodName;
|
||||
|
||||
if ((methodNameFlags & BfMethodNameFlag_IncludeReturnType) != 0)
|
||||
{
|
||||
methodName += TypeToString(methodInst->mReturnType);
|
||||
methodName += " ";
|
||||
}
|
||||
|
||||
String methodName;
|
||||
if ((methodNameFlags & BfMethodNameFlag_OmitTypeName) == 0)
|
||||
{
|
||||
methodName = TypeToString(type, typeNameFlags);
|
||||
|
|
|
@ -1496,7 +1496,7 @@ public:
|
|||
StringT<128> TypeToString(BfType* resolvedType, Array<String>* genericMethodParamNameOverrides = NULL);
|
||||
StringT<128> TypeToString(BfType* resolvedType, BfTypeNameFlags typeNameFlags, Array<String>* genericMethodParamNameOverrides = NULL);
|
||||
void DoTypeToString(StringImpl& str, BfType* resolvedType, BfTypeNameFlags typeNameFlags = BfTypeNameFlags_None, Array<String>* genericMethodParamNameOverrides = NULL);
|
||||
String MethodToString(BfMethodInstance* methodInst, BfMethodNameFlags methodNameFlags = BfMethodNameFlag_ResolveGenericParamNames, BfTypeVector* methodGenericArgs = NULL);
|
||||
StringT<128> MethodToString(BfMethodInstance* methodInst, BfMethodNameFlags methodNameFlags = BfMethodNameFlag_ResolveGenericParamNames, BfTypeVector* methodGenericArgs = NULL);
|
||||
void pv(BfType* type);
|
||||
void CurrentAddToConstHolder(BfIRValue& irVal);
|
||||
void ClearConstData();
|
||||
|
|
|
@ -11788,7 +11788,7 @@ void BfModule::DoTypeToString(StringImpl& str, BfType* resolvedType, BfTypeNameF
|
|||
|
||||
BfFieldInstance* fieldInstance = &tupleType->mFieldInstances[fieldIdx];
|
||||
BfFieldDef* fieldDef = fieldInstance->GetFieldDef();
|
||||
BfTypeNameFlags innerFlags = (BfTypeNameFlags)(typeNameFlags & ~(BfTypeNameFlag_OmitNamespace | BfTypeNameFlag_OmitOuterType));
|
||||
BfTypeNameFlags innerFlags = (BfTypeNameFlags)(typeNameFlags & ~(BfTypeNameFlag_OmitNamespace | BfTypeNameFlag_OmitOuterType | BfTypeNameFlag_ExtendedInfo));
|
||||
DoTypeToString(str, fieldInstance->GetResolvedType(), innerFlags, genericMethodNameOverrides);
|
||||
|
||||
char c = fieldDef->mName[0];
|
||||
|
@ -11842,7 +11842,7 @@ void BfModule::DoTypeToString(StringImpl& str, BfType* resolvedType, BfTypeNameF
|
|||
if (!isFirstParam)
|
||||
str += ", ";
|
||||
auto paramDef = methodDef->mParams[paramIdx];
|
||||
BfTypeNameFlags innerFlags = (BfTypeNameFlags)(typeNameFlags & ~(BfTypeNameFlag_OmitNamespace | BfTypeNameFlag_OmitOuterType));
|
||||
BfTypeNameFlags innerFlags = (BfTypeNameFlags)(typeNameFlags & ~(BfTypeNameFlag_OmitNamespace | BfTypeNameFlag_OmitOuterType | BfTypeNameFlag_ExtendedInfo));
|
||||
|
||||
auto paramType = delegateInfo->mParams[paramIdx];
|
||||
if ((paramIdx == 0) && (delegateInfo->mHasExplicitThis))
|
||||
|
@ -11886,7 +11886,23 @@ void BfModule::DoTypeToString(StringImpl& str, BfType* resolvedType, BfTypeNameF
|
|||
else if (resolvedType->IsTypeInstance())
|
||||
{
|
||||
BfTypeInstance* typeInstance = (BfTypeInstance*)resolvedType;
|
||||
|
||||
|
||||
if ((typeNameFlags & BfTypeNameFlag_ExtendedInfo) != 0)
|
||||
{
|
||||
if (typeInstance->mTypeDef->mIsDelegate)
|
||||
str += "delegate ";
|
||||
else if (typeInstance->mTypeDef->mIsFunction)
|
||||
str += "function ";
|
||||
else if (typeInstance->mTypeDef->mTypeCode == BfTypeCode_Object)
|
||||
str += "class ";
|
||||
else if (typeInstance->mTypeDef->mTypeCode == BfTypeCode_Enum)
|
||||
str += "enum ";
|
||||
else if (typeInstance->mTypeDef->mTypeCode == BfTypeCode_Struct)
|
||||
str += "struct ";
|
||||
else if (typeInstance->mTypeDef->mTypeCode == BfTypeCode_TypeAlias)
|
||||
str += "typealias ";
|
||||
}
|
||||
|
||||
bool omitNamespace = (typeNameFlags & BfTypeNameFlag_OmitNamespace) != 0;
|
||||
if ((typeNameFlags & BfTypeNameFlag_ReduceName) != 0)
|
||||
{
|
||||
|
@ -12039,7 +12055,7 @@ void BfModule::DoTypeToString(StringImpl& str, BfType* resolvedType, BfTypeNameF
|
|||
|
||||
if (i > prevGenericParamCount)
|
||||
str += ", ";
|
||||
DoTypeToString(str, typeGenericArg, (BfTypeNameFlags)(typeNameFlags & ~(BfTypeNameFlag_OmitNamespace | BfTypeNameFlag_OmitOuterType)), genericMethodNameOverrides);
|
||||
DoTypeToString(str, typeGenericArg, (BfTypeNameFlags)(typeNameFlags & ~(BfTypeNameFlag_OmitNamespace | BfTypeNameFlag_OmitOuterType | BfTypeNameFlag_ExtendedInfo)), genericMethodNameOverrides);
|
||||
}
|
||||
str += '>';
|
||||
}
|
||||
|
@ -12049,6 +12065,19 @@ void BfModule::DoTypeToString(StringImpl& str, BfType* resolvedType, BfTypeNameF
|
|||
str += '.';
|
||||
};
|
||||
|
||||
if (typeInstance->IsTypeAlias())
|
||||
{
|
||||
if ((typeNameFlags & BfTypeNameFlag_ExtendedInfo) != 0)
|
||||
{
|
||||
auto underlyingType = typeInstance->GetUnderlyingType();
|
||||
if (underlyingType != NULL)
|
||||
{
|
||||
str += " = ";
|
||||
DoTypeToString(str, underlyingType, (BfTypeNameFlags)(typeNameFlags & ~(BfTypeNameFlag_OmitNamespace | BfTypeNameFlag_OmitOuterType | BfTypeNameFlag_ExtendedInfo)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
else if (resolvedType->IsPrimitiveType())
|
||||
|
|
|
@ -47,13 +47,15 @@ enum BfTypeNameFlags : uint16
|
|||
BfTypeNameFlag_AddGlobalContainerName = 0x80,
|
||||
BfTypeNameFlag_InternalName = 0x100, // Use special delimiters to remove ambiguities (ie: '+' for inner types)
|
||||
BfTypeNameFlag_HideGlobalName = 0x200,
|
||||
BfTypeNameFlag_ExtendedInfo = 0x400
|
||||
};
|
||||
|
||||
enum BfMethodNameFlags : uint8
|
||||
{
|
||||
BfMethodNameFlag_None = 0,
|
||||
BfMethodNameFlag_ResolveGenericParamNames = 1,
|
||||
BfMethodNameFlag_OmitTypeName = 2
|
||||
BfMethodNameFlag_OmitTypeName = 2,
|
||||
BfMethodNameFlag_IncludeReturnType = 4
|
||||
};
|
||||
|
||||
enum BfGetMethodInstanceFlags : uint16
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue