Fix up code based selections after constraints
This commit is contained in:
@ -220,7 +220,7 @@ const Overlay = ({
|
|||||||
|
|
||||||
// For that reason, to prevent console noise, we do not use err here.
|
// For that reason, to prevent console noise, we do not use err here.
|
||||||
if (_node1 instanceof Error) {
|
if (_node1 instanceof Error) {
|
||||||
console.warn('ast older than pathToNode, not fatal, eventually settles')
|
console.warn('ast older than pathToNode, not fatal, eventually settles', '')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const callExpression = _node1.node
|
const callExpression = _node1.node
|
||||||
|
|||||||
@ -295,6 +295,7 @@ export const ModelingMachineProvider = ({
|
|||||||
const dispatchSelection = (selection?: EditorSelection) => {
|
const dispatchSelection = (selection?: EditorSelection) => {
|
||||||
if (!selection) return // TODO less of hack for the below please
|
if (!selection) return // TODO less of hack for the below please
|
||||||
if (!editorManager.editorView) return
|
if (!editorManager.editorView) return
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (!editorManager.editorView) return
|
if (!editorManager.editorView) return
|
||||||
editorManager.editorView.dispatch({
|
editorManager.editorView.dispatch({
|
||||||
|
|||||||
@ -513,12 +513,14 @@ export const modelingMachine = setup({
|
|||||||
},
|
},
|
||||||
// end guards
|
// end guards
|
||||||
actions: {
|
actions: {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
'code editor process changes': ({ event, context }) => {
|
||||||
'update code editor and write to file': async () => {
|
;(async () => {
|
||||||
const newCode = recast(kclManager.ast)
|
const newCode = recast(kclManager.ast)
|
||||||
if (err(newCode)) return
|
if (err(newCode)) return
|
||||||
await codeManager.updateCodeEditor(newCode)
|
await codeManager.updateCodeStateEditor(newCode)
|
||||||
await codeManager.writeToFile()
|
|
||||||
|
await codeManager.writeToFile()
|
||||||
|
})().catch(reportRejection)
|
||||||
},
|
},
|
||||||
'assign tool in context': assign({
|
'assign tool in context': assign({
|
||||||
currentTool: ({ event }) =>
|
currentTool: ({ event }) =>
|
||||||
@ -1572,7 +1574,8 @@ export const modelingMachine = setup({
|
|||||||
|
|
||||||
entry: [
|
entry: [
|
||||||
'setup client side sketch segments',
|
'setup client side sketch segments',
|
||||||
'update code editor and write to file',
|
|
||||||
|
'code editor process changes',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -1586,7 +1589,7 @@ export const modelingMachine = setup({
|
|||||||
}),
|
}),
|
||||||
onDone: {
|
onDone: {
|
||||||
target: 'SketchIdle',
|
target: 'SketchIdle',
|
||||||
actions: 'Set selection',
|
actions: ['code editor process changes', 'Set selection'],
|
||||||
},
|
},
|
||||||
onError: 'SketchIdle',
|
onError: 'SketchIdle',
|
||||||
},
|
},
|
||||||
@ -1602,7 +1605,7 @@ export const modelingMachine = setup({
|
|||||||
}),
|
}),
|
||||||
onDone: {
|
onDone: {
|
||||||
target: 'SketchIdle',
|
target: 'SketchIdle',
|
||||||
actions: 'Set selection',
|
actions: ['code editor process changes', 'Set selection'],
|
||||||
},
|
},
|
||||||
onError: 'SketchIdle',
|
onError: 'SketchIdle',
|
||||||
},
|
},
|
||||||
@ -1618,7 +1621,7 @@ export const modelingMachine = setup({
|
|||||||
}),
|
}),
|
||||||
onDone: {
|
onDone: {
|
||||||
target: 'SketchIdle',
|
target: 'SketchIdle',
|
||||||
actions: 'Set selection',
|
actions: ['code editor process changes', 'Set selection'],
|
||||||
},
|
},
|
||||||
onError: 'SketchIdle',
|
onError: 'SketchIdle',
|
||||||
},
|
},
|
||||||
@ -1634,7 +1637,7 @@ export const modelingMachine = setup({
|
|||||||
}),
|
}),
|
||||||
onDone: {
|
onDone: {
|
||||||
target: 'SketchIdle',
|
target: 'SketchIdle',
|
||||||
actions: 'Set selection',
|
actions: ['code editor process changes', 'Set selection'],
|
||||||
},
|
},
|
||||||
onError: 'SketchIdle',
|
onError: 'SketchIdle',
|
||||||
},
|
},
|
||||||
@ -1650,7 +1653,7 @@ export const modelingMachine = setup({
|
|||||||
}),
|
}),
|
||||||
onDone: {
|
onDone: {
|
||||||
target: 'SketchIdle',
|
target: 'SketchIdle',
|
||||||
actions: 'Set selection',
|
actions: ['code editor process changes', 'Set selection'],
|
||||||
},
|
},
|
||||||
onError: 'SketchIdle',
|
onError: 'SketchIdle',
|
||||||
},
|
},
|
||||||
@ -1666,7 +1669,7 @@ export const modelingMachine = setup({
|
|||||||
}),
|
}),
|
||||||
onDone: {
|
onDone: {
|
||||||
target: 'SketchIdle',
|
target: 'SketchIdle',
|
||||||
actions: 'Set selection',
|
actions: ['code editor process changes', 'Set selection'],
|
||||||
},
|
},
|
||||||
onError: 'SketchIdle',
|
onError: 'SketchIdle',
|
||||||
},
|
},
|
||||||
@ -1682,7 +1685,7 @@ export const modelingMachine = setup({
|
|||||||
}),
|
}),
|
||||||
onDone: {
|
onDone: {
|
||||||
target: 'SketchIdle',
|
target: 'SketchIdle',
|
||||||
actions: 'Set selection',
|
actions: ['code editor process changes', 'Set selection'],
|
||||||
},
|
},
|
||||||
onError: 'SketchIdle',
|
onError: 'SketchIdle',
|
||||||
},
|
},
|
||||||
@ -1818,7 +1821,7 @@ export const modelingMachine = setup({
|
|||||||
onError: 'SketchIdle',
|
onError: 'SketchIdle',
|
||||||
onDone: {
|
onDone: {
|
||||||
target: 'SketchIdle',
|
target: 'SketchIdle',
|
||||||
actions: ['Set selection'],
|
actions: ['code editor process changes', 'Set selection'],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -1839,7 +1842,7 @@ export const modelingMachine = setup({
|
|||||||
},
|
},
|
||||||
onDone: {
|
onDone: {
|
||||||
target: 'SketchIdle',
|
target: 'SketchIdle',
|
||||||
actions: 'Set selection',
|
actions: ['code editor process changes', 'Set selection'],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -1854,7 +1857,7 @@ export const modelingMachine = setup({
|
|||||||
}),
|
}),
|
||||||
onDone: {
|
onDone: {
|
||||||
target: 'SketchIdle',
|
target: 'SketchIdle',
|
||||||
actions: 'Set selection',
|
actions: ['code editor process changes', 'Set selection'],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -1869,7 +1872,7 @@ export const modelingMachine = setup({
|
|||||||
}),
|
}),
|
||||||
onDone: {
|
onDone: {
|
||||||
target: 'SketchIdle',
|
target: 'SketchIdle',
|
||||||
actions: 'Set selection',
|
actions: ['code editor process changes', 'Set selection'],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -1884,7 +1887,7 @@ export const modelingMachine = setup({
|
|||||||
}),
|
}),
|
||||||
onDone: {
|
onDone: {
|
||||||
target: 'SketchIdle',
|
target: 'SketchIdle',
|
||||||
actions: 'Set selection',
|
actions: ['code editor process changes', 'Set selection'],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -1899,7 +1902,7 @@ export const modelingMachine = setup({
|
|||||||
}),
|
}),
|
||||||
onDone: {
|
onDone: {
|
||||||
target: 'SketchIdle',
|
target: 'SketchIdle',
|
||||||
actions: 'Set selection',
|
actions: ['code editor process changes', 'Set selection'],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -1914,7 +1917,7 @@ export const modelingMachine = setup({
|
|||||||
}),
|
}),
|
||||||
onDone: {
|
onDone: {
|
||||||
target: 'SketchIdle',
|
target: 'SketchIdle',
|
||||||
actions: 'Set selection',
|
actions: ['code editor process changes', 'Set selection'],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -1929,7 +1932,7 @@ export const modelingMachine = setup({
|
|||||||
}),
|
}),
|
||||||
onDone: {
|
onDone: {
|
||||||
target: 'SketchIdle',
|
target: 'SketchIdle',
|
||||||
actions: 'Set selection',
|
actions: ['code editor process changes', 'Set selection'],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -1944,7 +1947,7 @@ export const modelingMachine = setup({
|
|||||||
}),
|
}),
|
||||||
onDone: {
|
onDone: {
|
||||||
target: 'SketchIdle',
|
target: 'SketchIdle',
|
||||||
actions: 'Set selection',
|
actions: ['code editor process changes', 'Set selection'],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -1959,7 +1962,7 @@ export const modelingMachine = setup({
|
|||||||
}),
|
}),
|
||||||
onDone: {
|
onDone: {
|
||||||
target: 'SketchIdle',
|
target: 'SketchIdle',
|
||||||
actions: 'Set selection',
|
actions: ['code editor process changes', 'Set selection'],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user