Revert "Revert multi-profile (#4812)"

This reverts commit efe8089b08.
This commit is contained in:
Kurt Hutten Irev-Dev
2024-12-18 07:08:41 +11:00
parent 76e7d80a55
commit 1e9cf6f256
61 changed files with 3589 additions and 1278 deletions

View File

@ -37,6 +37,7 @@ import { KclManager } from 'lang/KclSingleton'
import { reportRejection } from 'lib/trap'
import { markOnce } from 'lib/performance'
import { MachineManager } from 'components/MachineManagerProvider'
import { Node } from 'wasm-lib/kcl/bindings/Node'
// TODO(paultag): This ought to be tweakable.
const pingIntervalMs = 5_000
@ -2115,7 +2116,7 @@ export class EngineCommandManager extends EventTarget {
Object.values(this.pendingCommands).map((a) => a.promise)
)
}
updateArtifactGraph(ast: Program) {
updateArtifactGraph(ast: Node<Program>) {
this.artifactGraph = createArtifactGraph({
orderedCommands: this.orderedCommands,
responseMap: this.responseMap,
@ -2213,7 +2214,11 @@ export class EngineCommandManager extends EventTarget {
commandTypeToTarget: string
): string | undefined {
for (const [artifactId, artifact] of this.artifactGraph) {
if ('codeRef' in artifact && isOverlap(range, artifact.codeRef.range)) {
if (
'codeRef' in artifact &&
artifact.codeRef &&
isOverlap(range, artifact.codeRef.range)
) {
if (commandTypeToTarget === artifact.type) return artifactId
}
}