Skip to content
This repository was archived by the owner on Jan 11, 2023. It is now read-only.
This repository was archived by the owner on Jan 11, 2023. It is now read-only.

[Mapping] map watch expressions #4201

Description

@jasonLaster

It would be nice to map watch expressions when we're paused.

Here is a sketch that re-purposes what we do when we preview

diff --git a/src/actions/expressions.js b/src/actions/expressions.js
index d20a485..15751e7 100644
--- a/src/actions/expressions.js
+++ b/src/actions/expressions.js
@@ -87,14 +87,35 @@ export function evaluateExpressions() {
 }

 function evaluateExpression(expression: Expression) {
-  return function({ dispatch, getState, client }: ThunkArgs) {
+  return function({ dispatch, getState, client, sourceMaps }: ThunkArgs) {
     if (!expression.input) {
       console.warn("Expressions should not be empty");
       return;
     }

     const frameId = getSelectedFrameId(getState());
-    const input = wrapExpression(expression.input);
+
+
+    let expression;
+    if (isPaused()) {
+      const location = getSelectedLocation(state);
+      const source = getSelectedSource(state);
+      const generatedLocation = await sourceMaps.getGeneratedLocation(
+        { ...location.start, sourceId },
+        source.toJS()
+      );
+
+      expression = await getSourcemapedExpression(
+        { dispatch, sourceMaps },
+        generatedLocation,
+        expression.input
+      );
+    } else {
+      expression = expression.input
+    }
+
+    const input = wrapExpression(expression);
+
     return dispatch({
       type: "EVALUATE_EXPRESSION",
       input: expression.input,
(END)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    Priority

    None yet

    Jira

    None yet

    Severity

    None yet

    Estimate

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions