fix nested environment scopes + highlight runtime errors in editor

This commit is contained in:
Joeri Exelmans 2025-10-27 10:37:42 +01:00
parent 56467e5ea5
commit a81fe1e884
9 changed files with 77 additions and 43 deletions

View file

@ -50,7 +50,10 @@ export const RTHistoryItem = memo(function RTHistoryItem({ast, idx, item, prevIt
</div>;
}
else {
return <div className="runtimeState runtimeError">
// error item
return <div
className={"runtimeState runtimeError" + (active ? " active" : "")}
onMouseDown={useCallback(() => onMouseDown(idx, item.simtime), [idx, item.simtime])}>
<div>
{formatTime(item.simtime)}
&emsp;
@ -68,7 +71,8 @@ function ShowEnvironment(props: {environment: Environment}) {
return <div>{
[...props.environment.entries()]
.filter(([variable]) => !variable.startsWith('_'))
.map(([variable,value]) => `${variable}: ${value}`).join(', ')
// we strip the first 5 characters from 'variable' (remove "root.")
.map(([variable,value]) => `${variable.slice(5)}: ${value}`).join(', ')
}</div>;
}