diff --git a/src/calltree.js b/src/calltree.js index 6503f1b..afe7442 100644 --- a/src/calltree.js +++ b/src/calltree.js @@ -236,7 +236,7 @@ const expand_calltree_node = (state, node) => { } } -const jump_calltree_node = (_state, _current_calltree_node) => { +const jump_calltree_node = (_state, _current_calltree_node, do_not_set_location = false) => { const {state, node: current_calltree_node} = expand_calltree_node( _state, _current_calltree_node ) @@ -295,11 +295,13 @@ const jump_calltree_node = (_state, _current_calltree_node) => { } } - const with_location = next.current_calltree_node.toplevel - ? {...next, current_module: loc.module} - // TODO: better jump not start of function (arguments), but start - // of body? - : set_location(next, loc) + const with_location = do_not_set_location + ? next + : next.current_calltree_node.toplevel + ? {...next, current_module: loc.module} + // TODO: better jump not start of function (arguments), but start + // of body? + : set_location(next, loc) const with_selected_calltree_node = set_selected_calltree_node_by_loc( with_location, @@ -354,6 +356,10 @@ const jump_calltree_node = (_state, _current_calltree_node) => { } } +const show_value_explorer = state => { + return jump_calltree_node(state, state.current_calltree_node, true) +} + export const path_to_root = (root, child) => { const do_path = (root) => { if(root.id == child.id) { @@ -950,4 +956,5 @@ export const calltree_commands = { select_error, navigate_logs_position, navigate_logs_increment, + show_value_explorer, } diff --git a/src/cmd.js b/src/cmd.js index 8c23f4f..d07a79e 100644 --- a/src/cmd.js +++ b/src/cmd.js @@ -791,6 +791,8 @@ const get_value_explorer = (state, index) => { } const do_move_cursor = (state, index) => { + // TODO: if value explorer is null, show current fn return value and args? + const value_explorer = get_value_explorer(state, index) if( value_explorer != null diff --git a/src/editor/ui.js b/src/editor/ui.js index 8be90b8..4c543ce 100644 --- a/src/editor/ui.js +++ b/src/editor/ui.js @@ -205,6 +205,10 @@ export class UI { if(!skip_focus) { this.debugger[tab_id].focus() } + + if(tab_id == 'calltree' && !skip_focus) { + exec('calltree.show_value_explorer') + } } open_app_window() {