flow-development-collection
flow-development-collection copied to clipboard
FEATURE: EEL `dir()` debug helper
I propose to add an EEL dir() helper to get all variable names of current scope and dir(value) to get all accessible properties
When working with objects in eel its not always super straight forward as beginner to know what properties are accessible. (One needs to run the logic of ObjectAccess::getProperty in your head ^^)
I propose to add a little debug helper which tries to get all gettable properties (ObjectAccess::getGettableProperties) and return them.
This idea is not new and inspired by pythons dir method, that i have gladly used for debugging things without any documentation:
https://docs.python.org/3/library/functions.html#dir
To fully comply to the python spec and make dir work without arguments, to dump the current context keys, it must be made a "language feature". That means, that the EEL Context has special handling when call is executed with dir and no argument is passed. Instead we will output the keys from $this->value: https://github.com/neos/flow-development-collection/blob/21bf506e0d7e768b4449d480a91ed101d771b6e3/Neos.Eel/Classes/Context.php#L95
Additional thoughts about debugging in eel:
I think this dir helper would be great to have in combination with helpers like
${Debug.var_dump(value).die()}
inspired from https://github.com/PackageFactory/PackageFactory.Fusion.Debug
but i started this conversation about "PackageFactory.Fusion.Debug" once and it seems everyone has their favorite way of dumping stuff (link to slack)