1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 11:38:21 +02:00

Added autocomplete "all" option for ctor passthroughs

This commit is contained in:
Brian Fiete 2024-12-31 10:28:04 -08:00
parent ce9b2f8888
commit 45d6a12d5d
2 changed files with 23 additions and 6 deletions

View file

@ -654,7 +654,7 @@ void StringImpl::ReplaceLargerHelper(const StringView& find, const StringView& r
intptr moveOffset = replace.mLength - find.mLength;
for (intptr startIdx = 0; startIdx < mLength - find.mLength; startIdx++)
for (intptr startIdx = 0; startIdx <= mLength - find.mLength; startIdx++)
{
if (EqualsHelper(GetPtr() + startIdx, find.mPtr, find.mLength))
{
@ -720,7 +720,7 @@ void StringImpl::Replace(const StringView& find, const StringView & replace)
intptr inIdx = 0;
intptr outIdx = 0;
while (inIdx < mLength - find.mLength)
while (inIdx <= mLength - find.mLength)
{
if (EqualsHelper(ptr + inIdx, findPtr, find.mLength))
{

View file

@ -2760,7 +2760,7 @@ void BfAutoComplete::AddOverrides(const StringImpl& filter)
BfTypeInstance* curType = mModule->mCurTypeInstance;
while (curType != NULL)
{
{
for (auto methodDef : curType->mTypeDef->mMethods)
{
if (methodDef->mShow >= checkShow)
@ -2812,8 +2812,8 @@ void BfAutoComplete::AddOverrides(const StringImpl& filter)
StringT<512> insertString;
GetMethodInfo(methodInst, &insertString, &insertString, true, false);
if (insertString.IsEmpty())
continue;
AddEntry(AutoCompleteEntry("override", insertString), filter);
continue;
AddEntry(AutoCompleteEntry("override", insertString), filter);
}
if (curType->IsStruct())
@ -2833,6 +2833,8 @@ void BfAutoComplete::AddCtorPassthroughs()
BfTypeInstance* curType = mModule->mCurTypeInstance;
auto baseType = curType->mBaseType;
String totalInsertString;
Array<BfMethodInstance*> declMethods;
for (auto methodDef : curType->mTypeDef->mMethods)
{
@ -2847,7 +2849,7 @@ void BfAutoComplete::AddCtorPassthroughs()
continue;
declMethods.Add(methodInst);
}
for (auto methodDef : baseType->mTypeDef->mMethods)
{
if (methodDef->mShow != BfShow_Show)
@ -2884,6 +2886,21 @@ void BfAutoComplete::AddCtorPassthroughs()
if (insertString.IsEmpty())
continue;
AddEntry(AutoCompleteEntry("this", insertString), "");
int tabPos = (int)insertString.IndexOf('\t');
if (tabPos >= 0)
{
if (!totalInsertString.IsEmpty())
totalInsertString += "\r\r";
totalInsertString += insertString.Substring(tabPos + 1);
}
}
if ((!totalInsertString.IsEmpty()) && (mEntriesSet.GetCount() >= 2))
{
totalInsertString.Replace("\t", "\t\b");
totalInsertString.Insert(0, "this - all\t");
auto entry = AddEntry(AutoCompleteEntry("this", totalInsertString), "");
}
}