Merge remote-tracking branch 'origin' into kurt-bring-back-multi-profile

This commit is contained in:
Kurt Hutten Irev-Dev
2024-12-18 09:53:34 +11:00
8 changed files with 160 additions and 7 deletions

View File

@ -1209,3 +1209,20 @@ function getWallOrCapPlaneCodeRef(
range: planeCodeRef[0].range,
}
}
/**
* Get an artifact from a code source range
*/
export function getArtifactFromRange(
range: SourceRange,
artifactGraph: ArtifactGraph
): Artifact | null {
for (const artifact of artifactGraph.values()) {
if ('codeRef' in artifact && artifact.codeRef) {
const match =
artifact?.codeRef.range[0] === range[0] &&
artifact?.codeRef.range[1] === range[1]
if (match) return artifact
}
}
return null
}