Skip to content

Commit d354352

Browse files
committed
CompletionHandler: display "Entry Type" as a quick watch
Renamed the "Selection" quick watch entry to "Entry Value" for consistency / to avoid confusion with the new "selection" variable in the console.
1 parent 1bb7b48 commit d354352

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

flixel/system/debug/completion/CompletionHandler.hx

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ using flixel.util.FlxStringUtil;
1313

1414
class CompletionHandler
1515
{
16+
private static inline var ENTRY_VALUE = "Entry Value";
17+
private static inline var ENTRY_TYPE = "Entry Type";
18+
1619
private var completionList:CompletionList;
1720
private var input:TextField;
1821
private var watchingSelection:Bool = false;
@@ -144,18 +147,36 @@ class CompletionHandler
144147
var output = ConsoleUtil.runCommand(command);
145148

146149
watchingSelection = true;
147-
FlxG.watch.addQuick("Selection", output);
150+
FlxG.watch.addQuick(ENTRY_VALUE, output);
151+
FlxG.watch.addQuick(ENTRY_TYPE, getReadableType(output));
148152
}
149153
catch (e:Dynamic) {}
150154
#end
151155
}
156+
157+
private function getReadableType(v:Dynamic):String
158+
{
159+
return switch (Type.typeof(v))
160+
{
161+
case TNull: null;
162+
case TInt: "Int";
163+
case TFloat: "Float";
164+
case TBool: "Bool";
165+
case TObject: "Object";
166+
case TFunction: "Function";
167+
case TClass(c): FlxStringUtil.getClassName(c, true);
168+
case TEnum(e): FlxStringUtil.getClassName(e, true);
169+
case TUnknown: "Unknown";
170+
}
171+
}
152172

153173
private function completionClosed()
154174
{
155175
if (!watchingSelection)
156176
return;
157177

158-
FlxG.watch.removeQuick("Selection");
178+
FlxG.watch.removeQuick(ENTRY_VALUE);
179+
FlxG.watch.removeQuick(ENTRY_TYPE);
159180
watchingSelection = false;
160181
}
161182

0 commit comments

Comments
 (0)