1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 03:28:20 +02:00

Added named parameters to autocomplete

This commit is contained in:
Brian Fiete 2022-08-25 07:47:33 -07:00
parent 7406780f57
commit a587e6249e
2 changed files with 31 additions and 4 deletions

View file

@ -3833,6 +3833,17 @@ namespace IDE.ui
bool isEndingChar = (keyChar >= (char8)32) && !keyChar.IsLetterOrDigit && (keyChar != '_') && (keyChar != '~') && (keyChar != '=') && (keyChar != '!') && (keyChar != ':');
if ((mAutoComplete != null) && (mAutoComplete.mAutoCompleteListWidget != null) && (!mAutoComplete.mAutoCompleteListWidget.mEntryList.IsEmpty))
{
var entry = mAutoComplete.mAutoCompleteListWidget.mEntryList[mAutoComplete.mAutoCompleteListWidget.mSelectIdx];
char8 endC = entry.mEntryDisplay[entry.mEntryDisplay.Length - 1];
if ((endC == ':') &&
(keyChar == endC))
{
isEndingChar = true;
}
}
if (gApp.mSettings.mEditorSettings.mAutoCompleteRequireTab)
{
doAutocomplete = isCompletionChar;
@ -3954,7 +3965,7 @@ namespace IDE.ui
else
mAutoComplete.CloseListWindow();
if ((keyChar == '\t') || (keyChar == '\r')) // Let other chars besides explicit-insert chrars pass through
if ((keyChar == '\t') || (keyChar == '\r') || (keyChar == ':')) // Let other chars besides explicit-insert chrars pass through
{
allowChar = false;
}

View file

@ -8172,9 +8172,25 @@ void BfCompiler::GenerateAutocompleteInfo()
{
if (methodMatchInfo->mInstanceList.size() > 0)
{
if (autoComplete->mIdentifierUsed != NULL)
{
String filter;
if (autoComplete->mIdentifierUsed != NULL)
autoComplete->mIdentifierUsed->ToString(filter);
auto& bestInstance = methodMatchInfo->mInstanceList[methodMatchInfo->mBestIdx];
auto bestMethodDef = bestInstance.mMethodDef;
for (int paramIdx = 0; paramIdx < bestMethodDef->mParams.mSize; paramIdx++)
{
if ((paramIdx == 0) && (bestMethodDef->mMethodType == BfMethodType_Extension))
continue;
autoComplete->AddEntry(AutoCompleteEntry("param", bestMethodDef->mParams[paramIdx]->mName + ":"), filter);
}
}
String invokeInfoText;
invokeInfoText += StrFormat("%d", methodMatchInfo->mBestIdx);
for (int srcPosIdx = 0; srcPosIdx < (int) methodMatchInfo->mSrcPositions.size(); srcPosIdx++)
for (int srcPosIdx = 0; srcPosIdx < (int)methodMatchInfo->mSrcPositions.size(); srcPosIdx++)
invokeInfoText += StrFormat(" %d", methodMatchInfo->mSrcPositions[srcPosIdx]);
autoCompleteResultString += "invokeInfo\t";
autoCompleteResultString += invokeInfoText;