Closed christianp closed 9 months ago
The request to show an expanded view of values in the editor in numbas/editor#493 would make debugging marking algorithms easier, but it's worth adding this function, too.
debug
might be too ambiguous; maybe debug_string
?
@Lycanic - this would be a good issue for you to try when you're ready to do some work on Numbas internals.
Taking a look through some issues and this one intrigued me (/seemed possibly viable)
Things I wanted to check: a) Is this still a desired function (I notice the referenced other issue is closed)? b) what is an intended use/example? c) are the items 'tokenToDisplayString' and 'typeToDisplayString' in jme.js relevant?
(Example for b: is what we want that "Numbas.jme.debug_string(Numbas.jme.compile('expression("x+y")'))" would resolve to "Expression: 'x+y'"?, or is that completely off the mark intention wise?)
Suupose I have a question variable direction := vector(1,2,3)
.
I'd like to be able to write a JME expression in another variable's definition, or in a content area, showing the JME representation of direction
: debug_string(direction)
should return "vector(1, 2,3 )"
.
Internally, the debug_string function should call Numbas.jme.display.treeToJME({tok: tok})
, where tok
is the argument.
Could be useful while debugging marking algorithms -
feedback(debug(obj))