Skip to content

Commit a80c95c

Browse files
CATISNOTSODIUMCATISNOTSODIUM
andauthored
Fix(Tracer): display of values created by builtins list, is_... does not show anything (#3259)
* fix(tracer): rendering issue with literal AST * chore: run linter # Conflicts: # src/commons/sideContent/content/SideContentSubstVisualizer.tsx --------- Co-authored-by: CATISNOTSODIUM <[email protected]>
1 parent 07942c8 commit a80c95c

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/commons/sideContent/content/SideContentSubstVisualizer.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ type SubstVisualizerPropsAST = {
9494
};
9595

9696
const SideContentSubstVisualizer: React.FC<SubstVisualizerPropsAST> = props => {
97-
console.log(props);
9897
const [stepValue, setStepValue] = useState(1);
9998
const lastStepValue = props.content.length;
10099
const hasRunCode = lastStepValue !== 0;
@@ -245,10 +244,15 @@ function composeStyleWrapper(
245244
*/
246245
function renderNode(currentNode: StepperBaseNode, renderContext: RenderContext): React.ReactNode {
247246
const styleWrapper = renderContext.styleWrapper;
248-
249247
const renderers = {
250248
Literal(node: StepperLiteral) {
251-
return <span className="stepper-literal">{node.raw ? node.raw : node.value}</span>;
249+
const stringifyLiteralValue = (value: any) =>
250+
typeof value === 'string' ? '"' + value + '"' : value !== null ? value.toString() : 'null';
251+
return (
252+
<span className="stepper-literal">
253+
{node.raw ? node.raw : stringifyLiteralValue(node.value)}
254+
</span>
255+
);
252256
},
253257
Identifier(node: StepperIdentifier) {
254258
return <span>{node.name}</span>;

0 commit comments

Comments
 (0)