Cleanup rust/ts interface a but more w new rustContext (#5848)

* do the rust side

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* cleanup ts side

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* typo

Signed-off-by: Jess Frazelle <github@jessfraz.com>

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
Jess Frazelle
2025-03-17 18:26:11 -07:00
committed by GitHub
parent e17c6e272c
commit dd1534a61d
17 changed files with 351 additions and 398 deletions

View File

@ -66,7 +66,7 @@ import {
} from 'lib/singletons'
import { getNodeFromPath } from 'lang/queryAst'
import { getNodePathFromSourceRange } from 'lang/queryAstNodePathUtils'
import { executeAst, ToolTip } from 'lang/langHelpers'
import { executeAstMock, ToolTip } from 'lang/langHelpers'
import {
createProfileStartHandle,
dashedStraight,
@ -91,7 +91,6 @@ import {
createLabeledArg,
createLiteral,
createNodeFromExprSnippet,
createObjectExpression,
createPipeExpression,
createPipeSubstitution,
createVariableDeclaration,
@ -661,11 +660,9 @@ export class SceneEntities {
if (err(prepared)) return Promise.reject(prepared)
const { truncatedAst, variableDeclarationName } = prepared
const { execState } = await executeAst({
const { execState } = await executeAstMock({
ast: truncatedAst,
engineCommandManager: this.engineCommandManager,
rustContext,
isMock: true,
})
const sketchesInfo = getSketchesInfo({
sketchNodePaths,
@ -1239,11 +1236,9 @@ export class SceneEntities {
updateRectangleSketch(sketchInit, x, y, tag)
}
const { execState } = await executeAst({
const { execState } = await executeAstMock({
ast: truncatedAst,
engineCommandManager: this.engineCommandManager,
rustContext,
isMock: true,
})
const sketch = sketchFromKclValue(execState.variables[varName], varName)
if (err(sketch)) return Promise.reject(sketch)
@ -1445,11 +1440,9 @@ export class SceneEntities {
)
}
const { execState } = await executeAst({
const { execState } = await executeAstMock({
ast: truncatedAst,
engineCommandManager: this.engineCommandManager,
rustContext,
isMock: true,
})
const sketch = sketchFromKclValue(execState.variables[varName], varName)
if (err(sketch)) return Promise.reject(sketch)
@ -1624,11 +1617,9 @@ export class SceneEntities {
modded = moddedResult.modifiedAst
}
const { execState } = await executeAst({
const { execState } = await executeAstMock({
ast: modded,
engineCommandManager: this.engineCommandManager,
rustContext,
isMock: true,
})
const sketch = sketchFromKclValue(execState.variables[varName], varName)
if (err(sketch)) return
@ -2307,11 +2298,9 @@ export class SceneEntities {
modded = moddedResult.modifiedAst
}
const { execState } = await executeAst({
const { execState } = await executeAstMock({
ast: modded,
engineCommandManager: this.engineCommandManager,
rustContext,
isMock: true,
})
const sketch = sketchFromKclValue(execState.variables[varName], varName)
if (err(sketch)) return
@ -2886,11 +2875,9 @@ export class SceneEntities {
// don't want to mod the user's code yet as they have't committed to the change yet
// plus this would be the truncated ast being recast, it would be wrong
codeManager.updateCodeEditor(code)
const { execState } = await executeAst({
const { execState } = await executeAstMock({
ast: truncatedAst,
engineCommandManager: this.engineCommandManager,
rustContext,
isMock: true,
})
const variables = execState.variables
const sketchesInfo = getSketchesInfo({