1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-14 14:24:10 +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;
}
if (c == '\x04')
if ((c == '\x04') || (c == '\x05'))
{
queuedSpace = false;
atLineStart = true;
lineHadStar = false;
lineHadContent = false;
mDocString.Append('\n');
if (c == '\x05')
mDocString.Append(" ");
continue;
}

View file

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

View file

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