Browse Source

Added autocomplete "all" option for ctor passthroughs

Brian Fiete 6 months ago
parent
commit
45d6a12d5d
2 changed files with 23 additions and 6 deletions
  1. 2 2
      BeefySysLib/util/String.cpp
  2. 21 4
      IDEHelper/Compiler/BfAutoComplete.cpp

+ 2 - 2
BeefySysLib/util/String.cpp

@@ -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))
 		{

+ 21 - 4
IDEHelper/Compiler/BfAutoComplete.cpp

@@ -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), "");
 	}
 }