1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-15 14:54:09 +02:00

Fixed documentation on member with attributes

This commit is contained in:
Brian Fiete 2020-10-21 09:34:08 -07:00
parent 49788037cc
commit bf5e689029
3 changed files with 28 additions and 7 deletions

View file

@ -82,13 +82,15 @@ namespace IDE.ui
continue; continue;
} }
if (c == '\x04') if ((c == '\x04') || (c == '\x05'))
{ {
queuedSpace = false; queuedSpace = false;
atLineStart = true; atLineStart = true;
lineHadStar = false; lineHadStar = false;
lineHadContent = false; lineHadContent = false;
mDocString.Append('\n'); mDocString.Append('\n');
if (c == '\x05')
mDocString.Append(" ");
continue; continue;
} }

View file

@ -497,7 +497,7 @@ void BfAutoComplete::AddMethod(BfTypeInstance* typeInstance, BfMethodDef* method
else if (methodDecl->mDocumentation != NULL) else if (methodDecl->mDocumentation != NULL)
{ {
if (!str.IsEmpty()) if (!str.IsEmpty())
str += "\x04"; str += "\x05";
methodDecl->mDocumentation->GetDocString(str); methodDecl->mDocumentation->GetDocString(str);
} }
if (!str.IsEmpty()) if (!str.IsEmpty())
@ -566,10 +566,15 @@ void BfAutoComplete::AddTypeDef(BfTypeDef* typeDef, const StringImpl& filter, bo
String str; String str;
if (typeInst != NULL) if (typeInst != NULL)
str = mModule->TypeToString(typeInst, BfTypeNameFlag_ExtendedInfo); str = mModule->TypeToString(typeInst, BfTypeNameFlag_ExtendedInfo);
if (typeDef->mTypeDeclaration->mDocumentation != NULL) if (entryAdded->mDocumentation != NULL)
{
str += "\x04";
str.Append(entryAdded->mDocumentation);
}
else if (typeDef->mTypeDeclaration->mDocumentation != NULL)
{ {
if (!str.IsEmpty()) if (!str.IsEmpty())
str += "\x04"; str += "\x05";
typeDef->mTypeDeclaration->mDocumentation->GetDocString(str); typeDef->mTypeDeclaration->mDocumentation->GetDocString(str);
} }
entryAdded->mDocumentation = mAlloc.AllocString(str); entryAdded->mDocumentation = mAlloc.AllocString(str);
@ -654,9 +659,14 @@ void BfAutoComplete::AddField(BfTypeInstance* typeInst, BfFieldDef* fieldDef, Bf
str += mModule->TypeToString(typeInst); str += mModule->TypeToString(typeInst);
str += "."; str += ".";
str += fieldDef->mName; str += fieldDef->mName;
if (documentation != NULL) if (entryAdded->mDocumentation != NULL)
{ {
str += "\x04"; str += "\x04";
str.Append(entryAdded->mDocumentation);
}
else if (documentation != NULL)
{
str += "\x05";
documentation->GetDocString(str); documentation->GetDocString(str);
} }
entryAdded->mDocumentation = mAlloc.AllocString(str); entryAdded->mDocumentation = mAlloc.AllocString(str);
@ -722,9 +732,14 @@ void BfAutoComplete::AddProp(BfTypeInstance* typeInst, BfPropertyDef* propDef, c
str += "set; "; str += "set; ";
str += "}"; str += "}";
if (documentation != NULL) if (entryAdded->mDocumentation != NULL)
{ {
str += "\x04"; str += "\x04";
str.Append(entryAdded->mDocumentation);
}
else if (documentation != NULL)
{
str += "\x05";
documentation->GetDocString(str); documentation->GetDocString(str);
} }
entryAdded->mDocumentation = mAlloc.AllocString(str); entryAdded->mDocumentation = mAlloc.AllocString(str);

View file

@ -5722,8 +5722,12 @@ BfAstNode* BfReducer::ReadTypeMember(BfTokenNode* tokenNode, int depth, BfAstNod
return NULL; return NULL;
} }
SetAndRestoreValue<BfAstNode*> prevTypeMemberNodeStart(mTypeMemberNodeStart, attributes, false);
if (depth == 0)
prevTypeMemberNodeStart.Set();
mVisitorPos.MoveNext(); mVisitorPos.MoveNext();
auto memberNode = ReadTypeMember(nextNode, 0, (deferredHeadNode != NULL) ? deferredHeadNode : attributes); auto memberNode = ReadTypeMember(nextNode, depth + 1, (deferredHeadNode != NULL) ? deferredHeadNode : attributes);
if (memberNode == NULL) if (memberNode == NULL)
return NULL; return NULL;
auto member = BfNodeDynCast<BfMemberDeclaration>(memberNode); auto member = BfNodeDynCast<BfMemberDeclaration>(memberNode);