mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 20:42:21 +02:00
Added mouseover docs support
This commit is contained in:
parent
dc2603bc60
commit
e02b42d6f4
5 changed files with 58 additions and 28 deletions
|
@ -1855,6 +1855,17 @@ class BfCommentNode : public BfAstNode
|
|||
public:
|
||||
BF_AST_TYPE(BfCommentNode, BfAstNode);
|
||||
BfCommentKind mCommentKind;
|
||||
|
||||
void GetDocString(StringImpl& docString)
|
||||
{
|
||||
ToString(docString);
|
||||
for (int i = 0; i < (int)docString.length(); i++)
|
||||
{
|
||||
char c = docString[i];
|
||||
if (c == '\n')
|
||||
docString[i] = '\x3';
|
||||
}
|
||||
}
|
||||
}; BF_AST_DECL(BfCommentNode, BfAstNode);
|
||||
|
||||
class BfPreprocesorIgnoredSectionNode : public BfAstNode
|
||||
|
|
|
@ -7287,19 +7287,7 @@ void BfCompiler::GenerateAutocompleteInfo()
|
|||
|
||||
String& autoCompleteResultString = *gTLStrReturn.Get();
|
||||
autoCompleteResultString.Clear();
|
||||
|
||||
auto _GetDocString = [&](BfCommentNode* commentNode, StringImpl& docString)
|
||||
{
|
||||
commentNode->ToString(docString);
|
||||
for (int i = 0; i < (int)docString.length(); i++)
|
||||
{
|
||||
char c = docString[i];
|
||||
if (c == '\n')
|
||||
docString[i] = '\x3';
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
auto bfModule = mResolvePassData->mAutoComplete->mModule;
|
||||
if (bfModule != NULL)
|
||||
{
|
||||
|
@ -7653,7 +7641,7 @@ void BfCompiler::GenerateAutocompleteInfo()
|
|||
if ((methodDeclaration != NULL) && (methodDeclaration->mDocumentation != NULL))
|
||||
{
|
||||
String docString;
|
||||
_GetDocString(methodDeclaration->mDocumentation, docString);
|
||||
methodDeclaration->mDocumentation->GetDocString(docString);
|
||||
methodText += "\x03";
|
||||
methodText += docString;
|
||||
}
|
||||
|
@ -7689,7 +7677,7 @@ void BfCompiler::GenerateAutocompleteInfo()
|
|||
if ((entry->mDocumentation != NULL) && (wantsDocEntry != NULL) && (strcmp(wantsDocEntry, entry->mDisplay) == 0))
|
||||
{
|
||||
docString.Clear();
|
||||
_GetDocString(entry->mDocumentation, docString);
|
||||
entry->mDocumentation->GetDocString(docString);
|
||||
autoCompleteResultString += '\x03';
|
||||
autoCompleteResultString += docString;
|
||||
}
|
||||
|
|
|
@ -3850,7 +3850,7 @@ BfTypedValue BfExprEvaluator::LookupField(BfAstNode* targetSrc, BfTypedValue tar
|
|||
autoComplete->mResultString += field->mName;
|
||||
|
||||
if (fieldInstance->mConstIdx != -1)
|
||||
{
|
||||
{
|
||||
String constStr = autoComplete->ConstantToString(curCheckType->mConstHolder, BfIRValue(BfIRValueFlags_Const, fieldInstance->mConstIdx));
|
||||
if (!constStr.IsEmpty())
|
||||
{
|
||||
|
@ -3861,6 +3861,15 @@ BfTypedValue BfExprEvaluator::LookupField(BfAstNode* targetSrc, BfTypedValue tar
|
|||
autoComplete->mResultString += constStr;
|
||||
}
|
||||
}
|
||||
|
||||
auto fieldDecl = fieldInstance->GetFieldDef()->mFieldDeclaration;
|
||||
if ((fieldDecl != NULL) && (fieldDecl->mDocumentation != NULL))
|
||||
{
|
||||
String docString;
|
||||
fieldDecl->mDocumentation->GetDocString(docString);
|
||||
autoComplete->mResultString += "\x03";
|
||||
autoComplete->mResultString += docString;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7872,6 +7881,13 @@ BfTypedValue BfExprEvaluator::MatchMethod(BfAstNode* targetSrc, BfMethodBoundExp
|
|||
{
|
||||
autoComplete->mResultString = ":";
|
||||
autoComplete->mResultString += mModule->MethodToString(moduleMethodInstance.mMethodInstance);
|
||||
|
||||
auto methodDecl = moduleMethodInstance.mMethodInstance->mMethodDef->GetMethodDeclaration();
|
||||
if ((methodDecl != NULL) && (methodDecl->mDocumentation != NULL))
|
||||
{
|
||||
autoComplete->mResultString += "\x03";
|
||||
methodDecl->mDocumentation->GetDocString(autoComplete->mResultString);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue