enso-org / enso

Hybrid visual and textual functional programming.
https://enso.org
Apache License 2.0
7.34k stars 321 forks source link

Add a way to run a single node in a different context in engine. #10719

Open farmaazon opened 1 month ago

farmaazon commented 1 month ago

To implement #10486, we need to have a way of re-running a single node. With possibility of enabling output context on this node (like it would have Standard.Base.Runtime.with_enabled_context Standard.Base.Runtime.Context.Output "design" <| attached to the expression).

hubertp commented 1 month ago

This will likely end up as a duplicate of #10730

JaroslavTulach commented 2 weeks ago

Re-running a node in different "context" without modifying a source needs some changes in the language-server protocol - up to @4e6 and Hubert. I can only imagine we get a request to re-run a method while:

The next part of work is in IdExecutionInstrument:

Changing the state may require

e.g. to store State as "thread local variable" - but that's something we should do anyway.

4e6 commented 2 weeks ago

I propose to update the executionContext/recompute request with the new optional expressionConfigs parameter that tells to execute provided expressions in a specific execution environment

interface ExecutionContextRecomputeParameters {
  /** The execution context identifier. */
  contextId: ContextId;
  /** The expressions that will be invalidated before the execution. */
  invalidatedExpressions?: "all" | ExpressionId[];
  /** The execution environment that will be used in the execution. */
  executionEnvironment?: ExecutionEnvironment;
  /** The configuration of how to execute each expression. */
  expressionConfigs?: ExpressionConfig[];
}

interface ExpressionConfig {
  /** The expression identifier. */
  expressionId: UUID;
  /** Run the expression in a specified execution environment. */
  executionEnvironment?: ExecutionEnvironment;
}
JaroslavTulach commented 2 weeks ago

Updating recompute is good approach.

Alternative:

invalidatedExpressions?: "all" | ExpressionId[] | ExpressionConfig[]

Maybe you want to use ExpressionId even in expressionId: definition and not UUID?