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

Added type icon to code mouseovers

This commit is contained in:
Brian Fiete 2020-09-03 09:31:22 -07:00
parent 0347f997f2
commit 70c7067bb0
5 changed files with 57 additions and 16 deletions

View file

@ -720,9 +720,19 @@ namespace IDE.ui
String val = scope String();
if (evalString.StartsWith(":", StringComparison.Ordinal))
{
useListViewItem.Label = scope String(evalString, 1);
var showString = scope String(evalString, 1);
int crPos = showString.IndexOf('\n');
if (crPos != -1)
{
val.Append("\n\n");
val.Append(showString, crPos + 1);
showString.RemoveToEnd(crPos);
}
useListViewItem.Label = showString;
isStringLiteral = true;
/*int lineCount = 0;
for (int i = 0; i < evalString.Length; i++)
if (evalString[i] == '\n')
@ -758,7 +768,8 @@ namespace IDE.ui
}
var vals = scope List<StringView>(val.Split('\n'));
String.NewOrSet!(valueSubItem.mLabel, vals[0]);
//if (!vals[0].IsEmpty)
String.NewOrSet!(valueSubItem.mLabel, vals[0]);
if (vals[0] == "!sideeffects")
{
if (useListViewItem.mWatchRefreshButton == null)
@ -787,7 +798,7 @@ namespace IDE.ui
else
valueSubItem.mFailed = false;
if (vals.Count > 1)
if ((vals.Count > 1) && (!vals[1].IsEmpty))
String.NewOrSet!(watch.mResultTypeStr, vals[1]);
else
DeleteAndNullify!(watch.mResultTypeStr);
@ -804,6 +815,7 @@ namespace IDE.ui
watch.mCanEdit = false;
watch.mLanguage = .NotSet;
watch.mMemoryBreakpointAddr = 0;
DeleteAndNullify!(watch.mEditInitialize);
DeleteAndNullify!(watch.mAction);
for (int32 memberIdx = 0; memberIdx < cmdStringCount; memberIdx++)
@ -1073,9 +1085,11 @@ namespace IDE.ui
bool hadMembers = false;
bool hasLeftIcon = false;
bool hasRightValues = false;
listView.mLabelX = GS!(40);
float childHeights = 0;
bool hadLeftIcon = false;
for (WatchListViewItem listViewItem in listView.GetRoot().mChildItems)
{
childHeights += listViewItem.mSelfHeight + listViewItem.mChildAreaHeight + listViewItem.mBottomPadding;
@ -1110,15 +1124,20 @@ namespace IDE.ui
checkValueWidth += GS!(16);
valueWidth = Math.Max(valueWidth, checkValueWidth);
if (!listViewItem.mSubItems[1].mLabel.IsEmpty)
hasRightValues = true;
if (listViewItem.mWatchEntry.mResultType != WatchResultType.None)
hadLeftIcon = true;
hasLeftIcon = true;
}
if (!hadMembers)
listView.mLabelX -= GS!(14);
if (!hadLeftIcon)
if (!hasRightValues)
{
listView.mLabelX -= GS!(4);
if (hasLeftIcon)
listView.mLabelX += GS!(4);
else
listView.mLabelX -= GS!(4);
listView.mShowColumnGrid = false;
}

View file

@ -22,11 +22,12 @@ namespace IDE.ui
Float = 4,
MM128 = 8,
Object = 0x10,
Pointer = 0x20,
TypeClass = 0x40,
TypeValueType = 0x80,
Namespace = 0x100,
Text = 0x200
Interface = 0x20,
Pointer = 0x40,
TypeClass = 0x80,
TypeValueType = 0x100,
Namespace = 0x200,
Text = 0x400
}
public class WatchEntry
@ -92,6 +93,9 @@ namespace IDE.ui
case "int":
mResultType |= WatchResultType.Int;
return true;
case "interface":
mResultType |= WatchResultType.Interface;
return true;
case "float":
mResultType |= WatchResultType.Float;
return true;
@ -1193,6 +1197,10 @@ namespace IDE.ui
{
imageIdx = .Type_Class;
}
else if (mWatchEntry.mResultType.HasFlag(WatchResultType.Interface))
{
imageIdx = .Interface;
}
else if (mWatchEntry.mResultType.HasFlag(WatchResultType.TypeValueType))
{
imageIdx = .Type_ValueType;

View file

@ -2518,8 +2518,7 @@ void BfAutoComplete::CheckLocalRef(BfAstNode* identifierNode, BfLocalVariable* v
}
else
{
mResultString = ":";
mResultString += mModule->TypeToString(varDecl->mResolvedType);
SetResultStringType(varDecl->mResolvedType);
}
}
}
@ -3297,3 +3296,17 @@ void BfAutoComplete::FixitCheckNamespace(BfTypeDef* activeTypeDef, BfTypeReferen
FixitAddNamespace(typeRef, namespaceString);
}
}
void BfAutoComplete::SetResultStringType(BfType * type)
{
mResultString = ":";
mResultString += mModule->TypeToString(type);
if (type->IsObject())
mResultString += "\n:type\tclass";
else if (type->IsInterface())
mResultString += "\n:type\tinterface";
else if (type->IsPointer())
mResultString += "\n:type\tpointer";
else
mResultString += "\n:type\tvaluetype";
}

View file

@ -257,6 +257,8 @@ public:
void FixitAddMethod(BfTypeInstance* typeInst, const StringImpl& methodName, BfType* returnType, const BfTypeVector& paramTypes, bool wantStatic);
void FixitAddNamespace(BfAstNode* refNode, const StringImpl& namespacStr);
void FixitCheckNamespace(BfTypeDef* activeTypeDef, BfTypeReference* typeRef, BfTokenNode* nextDotToken);
void SetResultStringType(BfType* type);
};
NS_BF_END

View file

@ -6871,8 +6871,7 @@ BfType* BfModule::ResolveTypeResult(BfTypeReference* typeRef, BfType* resolvedTy
if ((autoComplete->mResolveType == BfResolveType_GetResultString) && (resolvedTypeRef != NULL))
{
autoComplete->mResultString = ":";
autoComplete->mResultString += TypeToString(resolvedTypeRef);
autoComplete->SetResultStringType(resolvedTypeRef);
}
}
}