1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 20:42:21 +02:00

Show invocation param info in mouseover

This commit is contained in:
Brian Fiete 2022-02-12 12:43:10 -05:00
parent b784101e93
commit cd3318cc3e
3 changed files with 68 additions and 9 deletions

View file

@ -261,7 +261,7 @@ namespace IDE.ui
float mOrigScreenY;
float mTaskbarXOffset;
float mTaskbarYOffset;
bool mIsShown;
public bool mIsShown;
bool mCreatedWindow;
bool mClosed;
bool mOwnsListView = true;
@ -752,7 +752,7 @@ namespace IDE.ui
showString.RemoveToEnd(crPos);
}
}
showString.Replace('\r', '\n');
useListViewItem.Label = showString;
isStringLiteral = true;
}
@ -1543,6 +1543,13 @@ namespace IDE.ui
public bool Show(TextPanel textPanel, float x, float y, String displayString, String evalString)
{
if ((mIsShown) && (evalString.StartsWith(':')))
{
mDisplayString.Set(evalString.Substring(1));
Rehup();
return true;
}
if (mIsShown)
Clear();

View file

@ -4763,8 +4763,6 @@ namespace IDE.ui
public void UpdateMouseover(bool mouseoverFired, bool mouseInbounds, int line, int lineChar, bool isManual = false)
{
#unwarn
CompilerBase compiler = ResolveCompiler;
@ -4989,8 +4987,10 @@ namespace IDE.ui
if (mHoverResolveTask != null)
{
if (mHoverResolveTask.mCursorPos != textIdx)
{
DeleteAndNullify!(mHoverResolveTask);
}
}
if ((!String.IsNullOrEmpty(mHoverResolveTask?.mResult)))
{
@ -5031,10 +5031,20 @@ namespace IDE.ui
}
}
if ((!didShow) &&
((debugExpr == null) || (isOverMessage) || (!mHoverWatch.Show(this, x, y, origDebugExpr ?? debugExpr, debugExpr))))
/*if ((!didShow) &&
((debugExpr == null) || (isOverMessage) || (!mHoverWatch.Show(this, x, y, origDebugExpr ?? debugExpr, debugExpr))))*/
if (!didShow)
{
if (mHoverResolveTask == null)
if ((debugExpr != null) && (!isOverMessage))
{
if ((mHoverWatch.mIsShown) && (!debugExpr.StartsWith(':')))
didShow = true;
else
didShow = mHoverWatch.Show(this, x, y, origDebugExpr ?? debugExpr, debugExpr);
}
if ((mHoverResolveTask == null) &&
((debugExpr == null) || (!debugExpr.StartsWith(':'))))
{
if ((!handlingHoverResolveTask) && (ResolveCompiler != null) && (!ResolveCompiler.mThreadWorkerHi.mThreadRunning) && (gApp.mSettings.mEditorSettings.mHiliteCursorReferences) && (!gApp.mDeterministic))
{
@ -5100,7 +5110,7 @@ namespace IDE.ui
}
#endif
if ((parser != null) && (mIsBeefSource))
if ((parser != null) && (mIsBeefSource) && (!didShow))
ErrorScope:
{
//TODO: Needed this?
@ -5226,7 +5236,7 @@ namespace IDE.ui
if ((DarkTooltipManager.sTooltip != null) && (DarkTooltipManager.sTooltip.mRelWidget == this))
DarkTooltipManager.CloseTooltip();
if (!CheckAllowHoverWatch())
if ((!CheckAllowHoverWatch()) && (mHoverResolveTask?.mResult == null))
{
return;
}

View file

@ -7391,6 +7391,48 @@ BfTypedValue BfExprEvaluator::CreateCall(BfAstNode* targetSrc, const BfTypedValu
failed = true;
}
if ((arg != NULL) && (autoComplete != NULL) && (autoComplete->mResolveType == BfResolveType_GetResultString) && (autoComplete->IsAutocompleteNode(arg)))
{
if (!autoComplete->mResultString.Contains('\r'))
{
String str;
str += methodInstance->GetParamName(paramIdx);
str += " @ ";
bool isCtor = methodInstance->mMethodDef->mMethodType == BfMethodType_Ctor;
if (isCtor)
str += methodInstance->GetOwner()->mTypeDef->mName->ToString();
else
str += methodInstance->mMethodDef->mName;
str += "(";
for (int i = isCtor ? 1 : 0; i < methodInstance->GetParamCount(); i++)
{
if (i > (isCtor ? 1 : 0))
str += ",";
if (i == paramIdx)
{
if (methodInstance->GetParamKind(paramIdx) == BfParamKind_Params)
str += "params ";
str += mModule->TypeToString(methodInstance->GetParamType(paramIdx));
}
}
str += ")";
if (!autoComplete->mResultString.StartsWith(":"))
autoComplete->mResultString.Clear();
int crPos = (int)autoComplete->mResultString.IndexOf('\n');
if (crPos == -1)
crPos = autoComplete->mResultString.mLength;
int insertPos = BF_MAX(1, crPos);
if (autoComplete->mResultString.IsEmpty())
autoComplete->mResultString += ":";
if (insertPos > 1)
str.Insert(0, '\r');
autoComplete->mResultString.Insert(insertPos, str);
}
}
if (argValue)
{
if ((isThis) && (argValue.mType->IsRef()))