mirror of
https://github.com/leporello-js/leporello-js
synced 2026-01-13 21:14:28 -08:00
index+lenght for value_explorer
This commit is contained in:
@@ -722,7 +722,8 @@ const select_return_value = state => {
|
|||||||
node,
|
node,
|
||||||
},
|
},
|
||||||
value_explorer: {
|
value_explorer: {
|
||||||
index: node.index + node.length,
|
index: node.index,
|
||||||
|
length: node.length,
|
||||||
result: result_node.result,
|
result: result_node.result,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -766,7 +767,8 @@ const select_arguments = (state, with_focus = true) => {
|
|||||||
node,
|
node,
|
||||||
},
|
},
|
||||||
value_explorer: {
|
value_explorer: {
|
||||||
index: node.index + node.length,
|
index: node.index,
|
||||||
|
length: node.length,
|
||||||
result,
|
result,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -515,7 +515,8 @@ const eval_selection = (state, index, is_expand) => {
|
|||||||
selection_state,
|
selection_state,
|
||||||
value_explorer: selection_state.ok
|
value_explorer: selection_state.ok
|
||||||
? {
|
? {
|
||||||
index: selection_state.node.index + selection_state.node.length,
|
index: selection_state.node.index,
|
||||||
|
length: selection_state.node.length,
|
||||||
result,
|
result,
|
||||||
}
|
}
|
||||||
: null
|
: null
|
||||||
@@ -660,6 +661,7 @@ const get_value_explorer = (state, index) => {
|
|||||||
// cursor in args, show args
|
// cursor in args, show args
|
||||||
return {
|
return {
|
||||||
index: frame.children[0].index,
|
index: frame.children[0].index,
|
||||||
|
length: frame.children[0].length,
|
||||||
result: frame.children[0].result,
|
result: frame.children[0].result,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -669,6 +671,7 @@ const get_value_explorer = (state, index) => {
|
|||||||
const result = frame.children[1].result
|
const result = frame.children[1].result
|
||||||
return {
|
return {
|
||||||
index: frame.children[1].index,
|
index: frame.children[1].index,
|
||||||
|
length: frame.children[1].length,
|
||||||
result: result.ok
|
result: result.ok
|
||||||
? result
|
? result
|
||||||
: find_error_origin_node(frame.children[1]).result
|
: find_error_origin_node(frame.children[1]).result
|
||||||
@@ -729,6 +732,7 @@ const get_value_explorer = (state, index) => {
|
|||||||
} else if(stmt.type == 'let') {
|
} else if(stmt.type == 'let') {
|
||||||
return {
|
return {
|
||||||
index: stmt.index,
|
index: stmt.index,
|
||||||
|
length: stmt.length,
|
||||||
result:
|
result:
|
||||||
{
|
{
|
||||||
ok: true,
|
ok: true,
|
||||||
@@ -755,7 +759,7 @@ const get_value_explorer = (state, index) => {
|
|||||||
result = find_error_origin_node(stmt).result
|
result = find_error_origin_node(stmt).result
|
||||||
}
|
}
|
||||||
|
|
||||||
return {index: stmt.index, result}
|
return {index: stmt.index, length: stmt.length, result}
|
||||||
}
|
}
|
||||||
|
|
||||||
const do_move_cursor = (state, index) => {
|
const do_move_cursor = (state, index) => {
|
||||||
|
|||||||
@@ -199,7 +199,7 @@ export class Editor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
embed_value_explorer({index, result: {ok, value, error}}) {
|
embed_value_explorer({index, length, result: {ok, value, error}}) {
|
||||||
this.unembed_value_explorer()
|
this.unembed_value_explorer()
|
||||||
|
|
||||||
const session = this.ace_editor.getSession()
|
const session = this.ace_editor.getSession()
|
||||||
|
|||||||
@@ -2262,8 +2262,10 @@ const y = x()`
|
|||||||
// expand call
|
// expand call
|
||||||
const s3 = COMMANDS.calltree.arrow_right(s2)
|
const s3 = COMMANDS.calltree.arrow_right(s2)
|
||||||
const s4 = COMMANDS.move_cursor(s3, code.indexOf('a'))
|
const s4 = COMMANDS.move_cursor(s3, code.indexOf('a'))
|
||||||
|
const selected = '(a, b)'
|
||||||
assert_equal(s4.value_explorer, {
|
assert_equal(s4.value_explorer, {
|
||||||
index: code.indexOf('(a, b)'),
|
index: code.indexOf(selected),
|
||||||
|
length: selected.length,
|
||||||
result: {ok: true, value: {a: 1, b: 2}},
|
result: {ok: true, value: {a: 1, b: 2}},
|
||||||
})
|
})
|
||||||
}),
|
}),
|
||||||
@@ -2277,6 +2279,7 @@ const y = x()`
|
|||||||
const s2 = COMMANDS.move_cursor(s1, code.indexOf('2'))
|
const s2 = COMMANDS.move_cursor(s1, code.indexOf('2'))
|
||||||
assert_equal(s2.value_explorer, {
|
assert_equal(s2.value_explorer, {
|
||||||
index: code.indexOf('y*2'),
|
index: code.indexOf('y*2'),
|
||||||
|
length: 3,
|
||||||
result: {ok: true, value: 4},
|
result: {ok: true, value: 4},
|
||||||
})
|
})
|
||||||
}),
|
}),
|
||||||
@@ -2290,6 +2293,7 @@ const y = x()`
|
|||||||
const s2 = COMMANDS.move_cursor(s1, code.indexOf('x'))
|
const s2 = COMMANDS.move_cursor(s1, code.indexOf('x'))
|
||||||
assert_equal(s2.value_explorer, {
|
assert_equal(s2.value_explorer, {
|
||||||
index: code.indexOf('let x'),
|
index: code.indexOf('let x'),
|
||||||
|
length: 5,
|
||||||
result: {ok: true, value: {x: 1}},
|
result: {ok: true, value: {x: 1}},
|
||||||
})
|
})
|
||||||
}),
|
}),
|
||||||
|
|||||||
Reference in New Issue
Block a user