Skip to content

Commit

Permalink
CompletionHandler: display "Entry Type" as a quick watch
Browse files Browse the repository at this point in the history
Renamed the "Selection" quick watch entry to "Entry Value" for consistency / to avoid confusion with the new "selection" variable in the console.
  • Loading branch information
Gama11 committed Mar 15, 2017
1 parent 1bb7b48 commit d354352
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions flixel/system/debug/completion/CompletionHandler.hx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ using flixel.util.FlxStringUtil;

class CompletionHandler
{
private static inline var ENTRY_VALUE = "Entry Value";
private static inline var ENTRY_TYPE = "Entry Type";

private var completionList:CompletionList;
private var input:TextField;
private var watchingSelection:Bool = false;
Expand Down Expand Up @@ -144,18 +147,36 @@ class CompletionHandler
var output = ConsoleUtil.runCommand(command);

watchingSelection = true;
FlxG.watch.addQuick("Selection", output);
FlxG.watch.addQuick(ENTRY_VALUE, output);
FlxG.watch.addQuick(ENTRY_TYPE, getReadableType(output));
}
catch (e:Dynamic) {}
#end
}

private function getReadableType(v:Dynamic):String
{
return switch (Type.typeof(v))
{
case TNull: null;
case TInt: "Int";
case TFloat: "Float";
case TBool: "Bool";
case TObject: "Object";
case TFunction: "Function";
case TClass(c): FlxStringUtil.getClassName(c, true);
case TEnum(e): FlxStringUtil.getClassName(e, true);
case TUnknown: "Unknown";
}
}

private function completionClosed()
{
if (!watchingSelection)
return;

FlxG.watch.removeQuick("Selection");
FlxG.watch.removeQuick(ENTRY_VALUE);
FlxG.watch.removeQuick(ENTRY_TYPE);
watchingSelection = false;
}

Expand Down

0 comments on commit d354352

Please sign in to comment.