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; 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)) 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 inIdx = 0;
intptr outIdx = 0; intptr outIdx = 0;
while (inIdx < mLength - find.mLength) while (inIdx <= mLength - find.mLength)
{ {
if (EqualsHelper(ptr + inIdx, findPtr, find.mLength)) if (EqualsHelper(ptr + inIdx, findPtr, find.mLength))
{ {

View file

@ -2833,6 +2833,8 @@ void BfAutoComplete::AddCtorPassthroughs()
BfTypeInstance* curType = mModule->mCurTypeInstance; BfTypeInstance* curType = mModule->mCurTypeInstance;
auto baseType = curType->mBaseType; auto baseType = curType->mBaseType;
String totalInsertString;
Array<BfMethodInstance*> declMethods; Array<BfMethodInstance*> declMethods;
for (auto methodDef : curType->mTypeDef->mMethods) for (auto methodDef : curType->mTypeDef->mMethods)
{ {
@ -2884,6 +2886,21 @@ void BfAutoComplete::AddCtorPassthroughs()
if (insertString.IsEmpty()) if (insertString.IsEmpty())
continue; continue;
AddEntry(AutoCompleteEntry("this", insertString), ""); 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), "");
} }
} }