Mancy
Mancy copied to clipboard
Auto expand object/array results
Maybe this options is implemented and I didn't find how to enable it.
Basically instead of write something and click in the object return to be expanded, expanded automatically:

Maybe could be possible setup a N depth level in settings
Maybe this options is implemented and I didn't find how to enable it.
It is not implemented. At the moment, we don't have the contextual information like depth
of the element.
Questions
- Which one is more useful? Top level or
N
level ? - What would be the
max
level If we provide support forN
levels? ( Remember, we will lose lazy rendering of elements uptoN
levels). There is a performance issue for rendering some big objects with more than one self aliases whenN
is big. (e.g.global
withGLOBAL
,global
androot
aliases) - Do we need depth support for
console output
andglobal environment
section ? - I think, its good to ignore depth support for nested special views like regex, buffer & charts.
[Off topic] I suggest to use regex viewer for the above example.
Actually I don't know how prints in the REPL is implemented, but I think that util.inspect (depth
option) could be useful for do it:
https://nodejs.org/api/util.html#util_util_inspect_object_options
This code is an example of copy/paste from internet. Although your offtopic is great sugar for the REPL, you need think that (IMHO) copy/paste is a universal driven development 😛.
@Kikobeats As per current implementation, there is no depth limit as such. Its lazy and therefore, the stack won't grow and is fast since we are serving nested object's view only when the user interested in viewing it. Configuration for top level auto expansion is good option. 👍 I don't see issues in carrying depth info around while building object tree.
Hmm but click in ">" is more a frontend issue, or how to resolve it?
@princejwesley I think it is a good idea to expand and show the result up to 2 levels. This should also be driven only through a setting. It is also good to have depth setting for console. Yes we can ignore depth support for Regex, Charts and Buffers
@Kikobeats >
carries a initial state that has to be toggled based on the configuration and pass on the current depth + 1
level to its immediate children.
Only problem is, we should limit the max depth
level(may be 5
or 8
).
Reasons are,
- JS objects are not directed acyclic graphs(DAGs). Objects may have reference loops(In
util#inspect
case,util#inspect
does know the circular references. In our case, objects are free and are built recursively on demand). - Too much depth expansion is not going to help. User has to extract/pull the deep nested object to have better view.
Would it be possible to implement this? How difficult is it? It would be really useful!