mirror of
https://github.com/leporello-js/leporello-js
synced 2026-01-13 13:04:30 -08:00
Always show value explorer at the line where statement starts
This commit is contained in:
23
src/cmd.js
23
src/cmd.js
@@ -476,13 +476,6 @@ const get_value_explorer = (state, index) => {
|
|||||||
|
|
||||||
const frame = active_frame(state)
|
const frame = active_frame(state)
|
||||||
|
|
||||||
if(frame.type == 'function_expr' && frame.body.type != 'do') {
|
|
||||||
return {
|
|
||||||
index: frame.children[1].index + frame.children[1].length,
|
|
||||||
result: frame.children[1].result
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(
|
if(
|
||||||
true
|
true
|
||||||
// not toplevel, function expr
|
// not toplevel, function expr
|
||||||
@@ -496,12 +489,19 @@ const get_value_explorer = (state, index) => {
|
|||||||
} else {
|
} else {
|
||||||
// cursor in args, show args
|
// cursor in args, show args
|
||||||
return {
|
return {
|
||||||
index: frame.children[0].index + frame.children[0].length,
|
index: frame.children[0].index,
|
||||||
result: frame.children[0].result,
|
result: frame.children[0].result,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(frame.type == 'function_expr' && frame.body.type != 'do') {
|
||||||
|
return {
|
||||||
|
index: frame.children[1].index,
|
||||||
|
result: frame.children[1].result
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const leaf = find_leaf(frame, index)
|
const leaf = find_leaf(frame, index)
|
||||||
const adjusted_leaf = (
|
const adjusted_leaf = (
|
||||||
// We are in the whitespace at the beginning or at the end of the file
|
// We are in the whitespace at the beginning or at the end of the file
|
||||||
@@ -555,7 +555,7 @@ const get_value_explorer = (state, index) => {
|
|||||||
result = stmt.children[0].result
|
result = stmt.children[0].result
|
||||||
} else if(stmt.type == 'let') {
|
} else if(stmt.type == 'let') {
|
||||||
return {
|
return {
|
||||||
index: stmt.index + stmt.length,
|
index: stmt.index,
|
||||||
result:
|
result:
|
||||||
{
|
{
|
||||||
ok: true,
|
ok: true,
|
||||||
@@ -585,9 +585,7 @@ const get_value_explorer = (state, index) => {
|
|||||||
result = find_error_origin_node(stmt).result
|
result = find_error_origin_node(stmt).result
|
||||||
}
|
}
|
||||||
|
|
||||||
const pos = stmt.index + stmt.length
|
return {index: stmt.index, result}
|
||||||
|
|
||||||
return {index: pos, result}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const do_move_cursor = (state, index) => {
|
const do_move_cursor = (state, index) => {
|
||||||
@@ -605,7 +603,6 @@ const do_move_cursor = (state, index) => {
|
|||||||
calltree_node_loc(state.active_calltree_node).module
|
calltree_node_loc(state.active_calltree_node).module
|
||||||
? {type: 'embed_value_explorer', args: [value_exp]}
|
? {type: 'embed_value_explorer', args: [value_exp]}
|
||||||
: null
|
: null
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user