* remove unused code in modelingMachine * remove unused actions in featureTreeMachine * video.pause is not async * remove unused param in Toolbar * remove unused rectangleOrigin from getRectangleCallExpressions * fmt * parseProjectRoute is not async anymore * prefix unused params with underscore * insertNewStartProfileAt/sketchEntryNodePath param is not used * remove unused constraintType parameter from getRemoveConstraintsTransform * underscore unused params * remove unused scale param in segment.ts * remove unused for in sceneInfra * remove unused sketchEntryNodePath from sceneEntitiesManager methods * remove unused shouldTearDown param * remove unused planeNodePath param from setup draft methods * remove unused ast param
This commit is contained in:
@ -142,9 +142,7 @@ export function Toolbar({
|
||||
} else if (isToolbarDropdown(maybeIconConfig)) {
|
||||
return {
|
||||
id: maybeIconConfig.id,
|
||||
array: maybeIconConfig.array.map((item) =>
|
||||
resolveItemConfig(item, maybeIconConfig.id)
|
||||
),
|
||||
array: maybeIconConfig.array.map((item) => resolveItemConfig(item)),
|
||||
}
|
||||
} else {
|
||||
return resolveItemConfig(maybeIconConfig)
|
||||
@ -152,8 +150,7 @@ export function Toolbar({
|
||||
})
|
||||
|
||||
function resolveItemConfig(
|
||||
maybeIconConfig: ToolbarItem,
|
||||
dropdownId?: string
|
||||
maybeIconConfig: ToolbarItem
|
||||
): ToolbarItemResolved {
|
||||
const isConfiguredAvailable = ['available', 'experimental'].includes(
|
||||
maybeIconConfig.status
|
||||
|
@ -218,7 +218,7 @@ export class SceneEntities {
|
||||
onCamChange = () => {
|
||||
const orthoFactor = orthoScale(this.sceneInfra.camControls.camera)
|
||||
const callbacks: (() => SegmentOverlayPayload | null)[] = []
|
||||
Object.values(this.activeSegments).forEach((segment, index) => {
|
||||
Object.values(this.activeSegments).forEach((segment, _index) => {
|
||||
const factor =
|
||||
(this.sceneInfra.camControls.camera instanceof OrthographicCamera
|
||||
? orthoFactor
|
||||
@ -354,7 +354,6 @@ export class SceneEntities {
|
||||
}
|
||||
|
||||
createSketchAxis(
|
||||
sketchPathToNode: PathToNode,
|
||||
forward: [number, number, number],
|
||||
up: [number, number, number],
|
||||
sketchPosition?: [number, number, number]
|
||||
@ -623,7 +622,6 @@ export class SceneEntities {
|
||||
|
||||
const inserted = insertNewStartProfileAt(
|
||||
this.kclManager.ast,
|
||||
sketchDetails.sketchEntryNodePath || [],
|
||||
sketchDetails.sketchNodePaths,
|
||||
sketchDetails.planeNodePath,
|
||||
[snappedClickPoint.x, snappedClickPoint.y],
|
||||
@ -679,7 +677,6 @@ export class SceneEntities {
|
||||
})
|
||||
const sketchesInfo = getSketchesInfo({
|
||||
sketchNodePaths,
|
||||
ast: maybeModdedAst,
|
||||
variables: execState.variables,
|
||||
kclManager: this.kclManager,
|
||||
})
|
||||
@ -926,8 +923,7 @@ export class SceneEntities {
|
||||
forward: [number, number, number],
|
||||
up: [number, number, number],
|
||||
origin: [number, number, number],
|
||||
segmentName: 'line' | 'tangentialArc' = 'line',
|
||||
shouldTearDown = true
|
||||
segmentName: 'line' | 'tangentialArc' = 'line'
|
||||
) => {
|
||||
const _ast = structuredClone(this.kclManager.ast)
|
||||
|
||||
@ -1001,7 +997,6 @@ export class SceneEntities {
|
||||
|
||||
const sketch = sketchFromPathToNode({
|
||||
pathToNode: sketchEntryNodePath,
|
||||
ast: this.kclManager.ast,
|
||||
variables: this.kclManager.variables,
|
||||
kclManager: this.kclManager,
|
||||
})
|
||||
@ -1185,7 +1180,6 @@ export class SceneEntities {
|
||||
})
|
||||
}
|
||||
setupDraftRectangle = async (
|
||||
sketchEntryNodePath: PathToNode,
|
||||
sketchNodePaths: PathToNode[],
|
||||
planeNodePath: PathToNode,
|
||||
forward: [number, number, number],
|
||||
@ -1256,7 +1250,7 @@ export class SceneEntities {
|
||||
// as draft segments
|
||||
startProfileAt.init = createPipeExpression([
|
||||
startProfileAt?.init,
|
||||
...getRectangleCallExpressions(rectangleOrigin, tag),
|
||||
...getRectangleCallExpressions(tag),
|
||||
])
|
||||
|
||||
const code = recast(_ast)
|
||||
@ -1395,7 +1389,6 @@ export class SceneEntities {
|
||||
}
|
||||
}
|
||||
setupDraftCenterRectangle = async (
|
||||
sketchEntryNodePath: PathToNode,
|
||||
sketchNodePaths: PathToNode[],
|
||||
planeNodePath: PathToNode,
|
||||
forward: [number, number, number],
|
||||
@ -1465,7 +1458,7 @@ export class SceneEntities {
|
||||
// as draft segments
|
||||
startProfileAt.init = createPipeExpression([
|
||||
startProfileAt?.init,
|
||||
...getRectangleCallExpressions(rectangleOrigin, tag),
|
||||
...getRectangleCallExpressions(tag),
|
||||
])
|
||||
const code = recast(_ast)
|
||||
__recastAst = parse(code)
|
||||
@ -1602,7 +1595,6 @@ export class SceneEntities {
|
||||
}
|
||||
}
|
||||
setupDraftCircleThreePoint = async (
|
||||
sketchEntryNodePath: PathToNode,
|
||||
sketchNodePaths: PathToNode[],
|
||||
planeNodePath: PathToNode,
|
||||
forward: [number, number, number],
|
||||
@ -1789,7 +1781,6 @@ export class SceneEntities {
|
||||
setupDraftArc = async (
|
||||
sketchEntryNodePath: PathToNode,
|
||||
sketchNodePaths: PathToNode[],
|
||||
planeNodePath: PathToNode,
|
||||
forward: [number, number, number],
|
||||
up: [number, number, number],
|
||||
sketchOrigin: [number, number, number],
|
||||
@ -2026,7 +2017,6 @@ export class SceneEntities {
|
||||
setupDraftArcThreePoint = async (
|
||||
sketchEntryNodePath: PathToNode,
|
||||
sketchNodePaths: PathToNode[],
|
||||
planeNodePath: PathToNode,
|
||||
forward: [number, number, number],
|
||||
up: [number, number, number],
|
||||
sketchOrigin: [number, number, number],
|
||||
@ -2286,7 +2276,6 @@ export class SceneEntities {
|
||||
}
|
||||
}
|
||||
setupDraftCircle = async (
|
||||
sketchEntryNodePath: PathToNode,
|
||||
sketchNodePaths: PathToNode[],
|
||||
planeNodePath: PathToNode,
|
||||
forward: [number, number, number],
|
||||
@ -2541,7 +2530,6 @@ export class SceneEntities {
|
||||
|
||||
const sketch = sketchFromPathToNode({
|
||||
pathToNode,
|
||||
ast: this.kclManager.ast,
|
||||
variables: this.kclManager.variables,
|
||||
kclManager: this.kclManager,
|
||||
})
|
||||
@ -3095,7 +3083,6 @@ export class SceneEntities {
|
||||
const variables = execState.variables
|
||||
const sketchesInfo = getSketchesInfo({
|
||||
sketchNodePaths,
|
||||
ast: truncatedAst,
|
||||
variables,
|
||||
kclManager: this.kclManager,
|
||||
})
|
||||
@ -3418,7 +3405,7 @@ export class SceneEntities {
|
||||
}
|
||||
this.editorManager.setHighlightRange([defaultSourceRange()])
|
||||
},
|
||||
onMouseLeave: ({ selected, ...rest }: OnMouseEnterLeaveArgs) => {
|
||||
onMouseLeave: ({ selected }: OnMouseEnterLeaveArgs) => {
|
||||
this.editorManager.setHighlightRange([defaultSourceRange()])
|
||||
const parent = getParentGroup(
|
||||
selected,
|
||||
@ -3782,12 +3769,10 @@ function prepareTruncatedAst(
|
||||
|
||||
function sketchFromPathToNode({
|
||||
pathToNode,
|
||||
ast,
|
||||
variables,
|
||||
kclManager,
|
||||
}: {
|
||||
pathToNode: PathToNode
|
||||
ast: Program
|
||||
variables: VariableMap
|
||||
kclManager: KclManager
|
||||
}): Sketch | null | Error {
|
||||
@ -3837,7 +3822,6 @@ export function getSketchQuaternion(
|
||||
): Quaternion | Error {
|
||||
const sketch = sketchFromPathToNode({
|
||||
pathToNode: sketchPathToNode,
|
||||
ast: kclManager.ast,
|
||||
variables: kclManager.variables,
|
||||
kclManager,
|
||||
})
|
||||
@ -3879,12 +3863,10 @@ function massageFormats(
|
||||
|
||||
function getSketchesInfo({
|
||||
sketchNodePaths,
|
||||
ast,
|
||||
variables,
|
||||
kclManager,
|
||||
}: {
|
||||
sketchNodePaths: PathToNode[]
|
||||
ast: Node<Program>
|
||||
variables: VariableMap
|
||||
kclManager: KclManager
|
||||
}): {
|
||||
@ -3898,7 +3880,6 @@ function getSketchesInfo({
|
||||
for (const path of sketchNodePaths) {
|
||||
const sketch = sketchFromPathToNode({
|
||||
pathToNode: path,
|
||||
ast,
|
||||
variables,
|
||||
kclManager,
|
||||
})
|
||||
|
@ -101,7 +101,6 @@ export class SceneInfra {
|
||||
readonly renderer: WebGLRenderer
|
||||
readonly labelRenderer: CSS2DRenderer
|
||||
readonly camControls: CameraControls
|
||||
private readonly fov = 45
|
||||
isFovAnimationInProgress = false
|
||||
_baseUnitMultiplier = 1
|
||||
_theme: Themes = Themes.System
|
||||
|
@ -307,7 +307,6 @@ class StraightSegment implements SegmentUtils {
|
||||
updateLine(snapLine, {
|
||||
from: snapLineFrom,
|
||||
to: [snapLineTo.x, snapLineTo.y],
|
||||
scale,
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -1076,7 +1075,6 @@ class ArcSegment implements SegmentUtils {
|
||||
radius: ANGLE_INDICATOR_RADIUS, // Half the radius for the indicator
|
||||
startAngle: 0,
|
||||
endAngle,
|
||||
scale,
|
||||
color: grey, // Red color for the angle indicator
|
||||
})
|
||||
angleIndicator.name = 'angleIndicator'
|
||||
@ -1087,7 +1085,6 @@ class ArcSegment implements SegmentUtils {
|
||||
radius: ANGLE_INDICATOR_RADIUS, // Half the radius for the indicator
|
||||
startAngle: 0,
|
||||
endAngle: (endAngle * Math.PI) / 180,
|
||||
scale,
|
||||
color: grey, // Green color for the end angle indicator
|
||||
})
|
||||
endAngleIndicator.name = 'endAngleIndicator'
|
||||
@ -1275,12 +1272,12 @@ class ArcSegment implements SegmentUtils {
|
||||
|
||||
const centerToFromLine = group.getObjectByName(ARC_CENTER_TO_FROM) as Line
|
||||
if (centerToFromLine) {
|
||||
updateLine(centerToFromLine, { from: center, to: from, scale })
|
||||
updateLine(centerToFromLine, { from: center, to: from })
|
||||
centerToFromLine.visible = isHandlesVisible
|
||||
}
|
||||
const centerToToLine = group.getObjectByName(ARC_CENTER_TO_TO) as Line
|
||||
if (centerToToLine) {
|
||||
updateLine(centerToToLine, { from: center, to, scale })
|
||||
updateLine(centerToToLine, { from: center, to })
|
||||
centerToToLine.visible = isHandlesVisible
|
||||
}
|
||||
const angleReferenceLine = group.getObjectByName(
|
||||
@ -1290,7 +1287,6 @@ class ArcSegment implements SegmentUtils {
|
||||
updateLine(angleReferenceLine, {
|
||||
from: center,
|
||||
to: [center[0] + 34 * scale, center[1]],
|
||||
scale,
|
||||
})
|
||||
angleReferenceLine.visible = isHandlesVisible
|
||||
}
|
||||
@ -1536,7 +1532,7 @@ class ThreePointArcSegment implements SegmentUtils {
|
||||
|
||||
return () => {
|
||||
const overlays: SegmentOverlays = {}
|
||||
const overlayDetails = [p2Handle, p3Handle].map((handle, index) =>
|
||||
const overlayDetails = [p2Handle, p3Handle].map((handle, _index) =>
|
||||
sceneInfra.updateOverlayDetails({
|
||||
handle: handle,
|
||||
group,
|
||||
@ -2042,11 +2038,7 @@ function createLine({
|
||||
|
||||
function updateLine(
|
||||
line: Line,
|
||||
{
|
||||
from,
|
||||
to,
|
||||
scale,
|
||||
}: { from: [number, number]; to: [number, number]; scale: number }
|
||||
{ from, to }: { from: [number, number]; to: [number, number] }
|
||||
) {
|
||||
// Implementation for updating a line
|
||||
const points = [
|
||||
@ -2061,14 +2053,12 @@ function createAngleIndicator({
|
||||
radius,
|
||||
startAngle,
|
||||
endAngle,
|
||||
scale,
|
||||
color,
|
||||
}: {
|
||||
center: [number, number]
|
||||
radius: number
|
||||
startAngle: number
|
||||
endAngle: number
|
||||
scale: number
|
||||
color: number
|
||||
}): Line {
|
||||
// Implementation for creating an angle indicator
|
||||
|
@ -36,7 +36,7 @@ export function AstExplorer() {
|
||||
type="checkbox"
|
||||
className="form-checkbox"
|
||||
checked={filterKeys.includes(key)}
|
||||
onChange={(e) => {
|
||||
onChange={(_e) => {
|
||||
if (filterKeys.includes(key)) {
|
||||
setFilterKeys(filterKeys.filter((k) => k !== key))
|
||||
} else {
|
||||
@ -51,7 +51,7 @@ export function AstExplorer() {
|
||||
</div>
|
||||
<div
|
||||
className="h-full relative"
|
||||
onMouseLeave={(e) => {
|
||||
onMouseLeave={(_e) => {
|
||||
editorManager.setHighlightRange([defaultSourceRange()])
|
||||
}}
|
||||
>
|
||||
|
@ -44,7 +44,7 @@ function CommandBarReview({ stepBack }: { stepBack: () => void }) {
|
||||
[argumentsToSubmit, selectedCommand]
|
||||
)
|
||||
|
||||
Object.keys(argumentsToSubmit).forEach((key, i) => {
|
||||
Object.keys(argumentsToSubmit).forEach((key, _i) => {
|
||||
const arg = selectedCommand?.args ? selectedCommand?.args[key] : undefined
|
||||
if (!arg) return
|
||||
})
|
||||
@ -75,7 +75,7 @@ function CommandBarReview({ stepBack }: { stepBack: () => void }) {
|
||||
className="absolute opacity-0 inset-0 pointer-events-none"
|
||||
onSubmit={submitCommand}
|
||||
>
|
||||
{Object.entries(argumentsToSubmit).map(([key, value], i) => {
|
||||
{Object.entries(argumentsToSubmit).map(([key, value], _i) => {
|
||||
const arg = selectedCommand?.args
|
||||
? selectedCommand?.args[key]
|
||||
: undefined
|
||||
|
@ -1489,7 +1489,6 @@ export const ModelingMachineProvider = ({
|
||||
return reject('No sketch details or data')
|
||||
|
||||
const result = await sceneEntitiesManager.setupDraftCircle(
|
||||
sketchDetails.sketchEntryNodePath,
|
||||
sketchDetails.sketchNodePaths,
|
||||
sketchDetails.planeNodePath,
|
||||
sketchDetails.zAxis,
|
||||
@ -1510,7 +1509,6 @@ export const ModelingMachineProvider = ({
|
||||
|
||||
const result =
|
||||
await sceneEntitiesManager.setupDraftCircleThreePoint(
|
||||
sketchDetails.sketchEntryNodePath,
|
||||
sketchDetails.sketchNodePaths,
|
||||
sketchDetails.planeNodePath,
|
||||
sketchDetails.zAxis,
|
||||
@ -1531,7 +1529,6 @@ export const ModelingMachineProvider = ({
|
||||
return reject('No sketch details or data')
|
||||
|
||||
const result = await sceneEntitiesManager.setupDraftRectangle(
|
||||
sketchDetails.sketchEntryNodePath,
|
||||
sketchDetails.sketchNodePaths,
|
||||
sketchDetails.planeNodePath,
|
||||
sketchDetails.zAxis,
|
||||
@ -1550,7 +1547,6 @@ export const ModelingMachineProvider = ({
|
||||
if (!sketchDetails || !data)
|
||||
return reject('No sketch details or data')
|
||||
const result = await sceneEntitiesManager.setupDraftCenterRectangle(
|
||||
sketchDetails.sketchEntryNodePath,
|
||||
sketchDetails.sketchNodePaths,
|
||||
sketchDetails.planeNodePath,
|
||||
sketchDetails.zAxis,
|
||||
@ -1571,7 +1567,6 @@ export const ModelingMachineProvider = ({
|
||||
const result = await sceneEntitiesManager.setupDraftArcThreePoint(
|
||||
sketchDetails.sketchEntryNodePath,
|
||||
sketchDetails.sketchNodePaths,
|
||||
sketchDetails.planeNodePath,
|
||||
sketchDetails.zAxis,
|
||||
sketchDetails.yAxis,
|
||||
sketchDetails.origin,
|
||||
@ -1590,7 +1585,6 @@ export const ModelingMachineProvider = ({
|
||||
const result = await sceneEntitiesManager.setupDraftArc(
|
||||
sketchDetails.sketchEntryNodePath,
|
||||
sketchDetails.sketchNodePaths,
|
||||
sketchDetails.planeNodePath,
|
||||
sketchDetails.zAxis,
|
||||
sketchDetails.yAxis,
|
||||
sketchDetails.origin,
|
||||
|
@ -55,9 +55,6 @@ export const FeatureTreePane = () => {
|
||||
},
|
||||
})
|
||||
},
|
||||
sendEditFlowStart: () => {
|
||||
modelingSend({ type: 'Enter sketch' })
|
||||
},
|
||||
scrollToError: () => {
|
||||
editorManager.scrollToFirstErrorDiagnosticIfExists()
|
||||
},
|
||||
|
@ -22,7 +22,7 @@ export const MemoryPaneMenu = () => {
|
||||
navigator.clipboard
|
||||
.writeText(JSON.stringify(variables))
|
||||
.then(() => toast.success('Program memory copied to clipboard'))
|
||||
.catch((e) =>
|
||||
.catch((_e) =>
|
||||
trap(new Error('Failed to copy program memory to clipboard'))
|
||||
)
|
||||
}
|
||||
|
@ -58,8 +58,7 @@ export function removeConstrainingValuesInfo({
|
||||
|
||||
const transforms = getRemoveConstraintsTransforms(
|
||||
updatedSelectionRanges,
|
||||
kclManager.ast,
|
||||
'removeConstrainingValues'
|
||||
kclManager.ast
|
||||
)
|
||||
if (err(transforms)) return transforms
|
||||
|
||||
|
@ -1005,7 +1005,7 @@ sketch003 = startSketchOn(XZ)
|
||||
] as const
|
||||
test.each(cases)(
|
||||
'%s',
|
||||
async (name, { codeBefore, codeAfter, lineOfInterest, type }) => {
|
||||
async (_name, { codeBefore, codeAfter, lineOfInterest, type }) => {
|
||||
// const lineOfInterest = 'line(end = [-2.94, 2.7])'
|
||||
const ast = assertParse(codeBefore)
|
||||
const execState = await enginelessExecutor(ast)
|
||||
|
@ -103,7 +103,6 @@ export function startSketchOnDefault(
|
||||
|
||||
export function insertNewStartProfileAt(
|
||||
node: Node<Program>,
|
||||
sketchEntryNodePath: PathToNode,
|
||||
sketchNodePaths: PathToNode[],
|
||||
planeNodePath: PathToNode,
|
||||
at: [number, number],
|
||||
|
@ -264,7 +264,7 @@ export async function deleteFromSelection(
|
||||
).filter((wall) => wall?.pathIds?.length)
|
||||
const wallIds = wallsWithDependencies.map((wall) => wall.id)
|
||||
|
||||
Object.entries(variables).forEach(([key, _var]) => {
|
||||
Object.entries(variables).forEach(([_key, _var]) => {
|
||||
if (
|
||||
_var?.type === 'Face' &&
|
||||
wallIds.includes(_var.value.artifactId)
|
||||
|
@ -631,7 +631,7 @@ describe('Testing traverse and pathToNode', () => {
|
||||
'very nested, array, object, callExpression, array, memberExpression',
|
||||
'.yo',
|
||||
],
|
||||
])('testing %s', async (testName, literalOfInterest) => {
|
||||
])('testing %s', async (_testName, literalOfInterest) => {
|
||||
const code = `myVar = 5
|
||||
sketch001 = startSketchOn(XZ)
|
||||
|> startProfile(at = [3.29, 7.86])
|
||||
|
@ -1244,8 +1244,7 @@ const transformMap: TransformMap = {
|
||||
}
|
||||
|
||||
export function getRemoveConstraintsTransform(
|
||||
sketchFnExp: CallExpressionKw,
|
||||
constraintType: ConstraintType
|
||||
sketchFnExp: CallExpressionKw
|
||||
): TransformInfo | false {
|
||||
let name = sketchFnExp.callee.name.name as ToolTip
|
||||
if (!toolTips.includes(name)) {
|
||||
@ -1779,8 +1778,7 @@ export function getTransformInfos(
|
||||
|
||||
export function getRemoveConstraintsTransforms(
|
||||
selectionRanges: Selections,
|
||||
ast: Program,
|
||||
constraintType: ConstraintType
|
||||
ast: Program
|
||||
): TransformInfo[] | Error {
|
||||
const nodes = selectionRanges.graphSelections.map(({ codeRef }) =>
|
||||
getNodeFromPath<Expr>(ast, codeRef.pathToNode)
|
||||
@ -1796,7 +1794,7 @@ export function getRemoveConstraintsTransforms(
|
||||
|
||||
const node = nodeMeta.node
|
||||
if (node?.type === 'CallExpressionKw') {
|
||||
return getRemoveConstraintsTransform(node, constraintType)
|
||||
return getRemoveConstraintsTransform(node)
|
||||
}
|
||||
|
||||
return false
|
||||
|
@ -64,7 +64,7 @@ export function createApplicationCommands({
|
||||
isDesktop() &&
|
||||
commandsContext.argumentsToSubmit.method === 'existingProject',
|
||||
skip: true,
|
||||
options: (_, context) => {
|
||||
options: (_, _context) => {
|
||||
const { folders } = systemIOActor.getSnapshot().context
|
||||
const options: CommandArgumentOption<string>[] = []
|
||||
folders.forEach((folder) => {
|
||||
@ -217,7 +217,7 @@ export function createApplicationCommands({
|
||||
isDesktop() &&
|
||||
commandsContext.argumentsToSubmit.method === 'existingProject',
|
||||
skip: true,
|
||||
options: (_, context) => {
|
||||
options: (_, _context) => {
|
||||
const { folders } = systemIOActor.getSnapshot().context
|
||||
const options: CommandArgumentOption<string>[] = []
|
||||
folders.forEach((folder) => {
|
||||
|
@ -825,7 +825,7 @@ export const modelingMachineCommandConfig: StateMachineCommandSetConfig<
|
||||
Object.entries(kclManager.execState.variables)
|
||||
// TODO: @franknoirot && @jtran would love to make this go away soon 🥺
|
||||
.filter(([_, variable]) => variable?.type === 'Number')
|
||||
.map(([name, variable]) => {
|
||||
.map(([name, _variable]) => {
|
||||
const node = getVariableDeclaration(kclManager.ast, name)
|
||||
if (node === undefined) return
|
||||
const range: SourceRange = [node.start, node.end, node.moduleId]
|
||||
@ -926,7 +926,7 @@ export const modelingMachineCommandConfig: StateMachineCommandSetConfig<
|
||||
inputType: 'kcl',
|
||||
required: true,
|
||||
createVariable: 'byDefault',
|
||||
variableName(commandBarContext, machineContext) {
|
||||
variableName(commandBarContext, _machineContext) {
|
||||
const { currentValue } = commandBarContext.argumentsToSubmit
|
||||
if (
|
||||
!currentValue ||
|
||||
|
@ -224,7 +224,7 @@ export function createNamedViewsCommand() {
|
||||
name: {
|
||||
required: true,
|
||||
inputType: 'options',
|
||||
options: (commandBar, machineContext) => {
|
||||
options: (_commandBar, _machineContext) => {
|
||||
const settings = getSettings()
|
||||
const namedViews = {
|
||||
...settings.app.namedViews.current,
|
||||
|
@ -222,7 +222,7 @@ export function createProjectCommands({
|
||||
isDesktop() &&
|
||||
commandsContext.argumentsToSubmit.method === 'existingProject',
|
||||
skip: true,
|
||||
options: (_, context) => {
|
||||
options: (_, _context) => {
|
||||
const folders = folderSnapshot()
|
||||
const options: CommandArgumentOption<string>[] = []
|
||||
folders.forEach((folder) => {
|
||||
|
@ -15,7 +15,7 @@ export function createRouteCommands(
|
||||
groupId: 'routes',
|
||||
icon: 'settings',
|
||||
needsReview: false,
|
||||
onSubmit: (data) => {
|
||||
onSubmit: (_data) => {
|
||||
const path = location.pathname.includes(PATHS.FILE)
|
||||
? filePath + PATHS.TELEMETRY + '?tab=project'
|
||||
: PATHS.HOME + PATHS.TELEMETRY
|
||||
@ -30,7 +30,7 @@ export function createRouteCommands(
|
||||
groupId: 'routes',
|
||||
icon: 'settings',
|
||||
needsReview: false,
|
||||
onSubmit: (data) => {
|
||||
onSubmit: (_data) => {
|
||||
navigate(PATHS.HOME)
|
||||
},
|
||||
}
|
||||
@ -42,7 +42,7 @@ export function createRouteCommands(
|
||||
groupId: 'routes',
|
||||
icon: 'settings',
|
||||
needsReview: false,
|
||||
onSubmit: (data) => {
|
||||
onSubmit: (_data) => {
|
||||
const path = location.pathname.includes(PATHS.FILE)
|
||||
? filePath + PATHS.SETTINGS + '?tab=project'
|
||||
: PATHS.HOME + PATHS.SETTINGS
|
||||
|
@ -441,7 +441,7 @@ export class CoreDumpManager {
|
||||
screenshot()
|
||||
.then((screenshotStr: string) => screenshotStr)
|
||||
// maybe rust should handle an error, but an empty string at least doesn't cause the core dump to fail entirely
|
||||
.catch((error: any) => ``)
|
||||
.catch((_error: any) => ``)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ describe('testing parseProjectRoute', () => {
|
||||
},
|
||||
}
|
||||
const route = '/home/somebody/projects/project'
|
||||
expect(await parseProjectRoute(config, route, path)).toEqual({
|
||||
expect(parseProjectRoute(config, route, path)).toEqual({
|
||||
projectName: 'project',
|
||||
projectPath: route,
|
||||
currentFileName: null,
|
||||
@ -28,7 +28,7 @@ describe('testing parseProjectRoute', () => {
|
||||
},
|
||||
}
|
||||
const route = '/home/somebody/projects'
|
||||
expect(await parseProjectRoute(config, route, path)).toEqual({
|
||||
expect(parseProjectRoute(config, route, path)).toEqual({
|
||||
projectName: null,
|
||||
projectPath: route,
|
||||
currentFileName: null,
|
||||
@ -44,7 +44,7 @@ describe('testing parseProjectRoute', () => {
|
||||
},
|
||||
}
|
||||
const route = '/home/somebody/projects/assembly/main.kcl'
|
||||
expect(await parseProjectRoute(config, route, path)).toEqual({
|
||||
expect(parseProjectRoute(config, route, path)).toEqual({
|
||||
projectName: 'assembly',
|
||||
projectPath: '/home/somebody/projects/assembly',
|
||||
currentFileName: 'main.kcl',
|
||||
@ -60,7 +60,7 @@ describe('testing parseProjectRoute', () => {
|
||||
},
|
||||
}
|
||||
const route = '/home/somebody/projects/assembly/subdir/main.kcl'
|
||||
expect(await parseProjectRoute(config, route, path)).toEqual({
|
||||
expect(parseProjectRoute(config, route, path)).toEqual({
|
||||
projectName: 'assembly',
|
||||
projectPath: '/home/somebody/projects/assembly',
|
||||
currentFileName: 'main.kcl',
|
||||
@ -70,7 +70,7 @@ describe('testing parseProjectRoute', () => {
|
||||
it('should work in the browser context', async () => {
|
||||
let config = {}
|
||||
const route = '/browser/main.kcl'
|
||||
expect(await parseProjectRoute(config, route, undefined)).toEqual({
|
||||
expect(parseProjectRoute(config, route, undefined)).toEqual({
|
||||
projectName: 'browser',
|
||||
projectPath: '/browser',
|
||||
currentFileName: 'main.kcl',
|
||||
|
@ -51,10 +51,7 @@ function angledLine(
|
||||
* |> angledLine(angle = segAng(a), length = -segLen(a), tag = $c)
|
||||
* |> close()
|
||||
*/
|
||||
export const getRectangleCallExpressions = (
|
||||
rectangleOrigin: [number, number],
|
||||
tag: string
|
||||
) => {
|
||||
export const getRectangleCallExpressions = (tag: string) => {
|
||||
return [
|
||||
angledLine(
|
||||
createLiteral(0), // 0 deg
|
||||
|
@ -322,7 +322,7 @@ export function createSettings() {
|
||||
}),
|
||||
namedViews: new Setting<{ [key in string]: NamedView }>({
|
||||
defaultValue: {},
|
||||
validate: (v) => true,
|
||||
validate: (_v) => true,
|
||||
hideOnLevel: 'user',
|
||||
}),
|
||||
},
|
||||
|
@ -455,7 +455,7 @@ export function clearSettingsAtLevel(
|
||||
allSettings: typeof settings,
|
||||
level: SettingsLevel
|
||||
) {
|
||||
Object.entries(allSettings).forEach(([category, settingsCategory]) => {
|
||||
Object.entries(allSettings).forEach(([_category, settingsCategory]) => {
|
||||
Object.entries(settingsCategory).forEach(
|
||||
([_, settingValue]: [string, Setting]) => {
|
||||
settingValue[level] = undefined
|
||||
|
@ -58,7 +58,7 @@ export async function holdOntoVideoFrameInCanvas(
|
||||
video: HTMLVideoElement,
|
||||
canvas: HTMLCanvasElement
|
||||
) {
|
||||
await video.pause()
|
||||
video.pause()
|
||||
canvas.width = video.videoWidth
|
||||
canvas.height = video.videoHeight
|
||||
canvas.style.width = video.videoWidth + 'px'
|
||||
@ -119,7 +119,7 @@ export const engineStreamMachine = setup({
|
||||
const video = context.videoRef.current
|
||||
if (!video) return
|
||||
|
||||
await video.pause()
|
||||
video.pause()
|
||||
|
||||
const canvas = context.canvasRef.current
|
||||
if (!canvas) return
|
||||
|
@ -253,9 +253,7 @@ export const featureTreeMachine = setup({
|
||||
}),
|
||||
sendSelectionEvent: () => {},
|
||||
openCodePane: () => {},
|
||||
sendEditFlowStart: () => {},
|
||||
scrollToError: () => {},
|
||||
sendD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VzqLWWuVGFr4W5uExDY+EZMEQqB6mKBSykvD-jOZ5Q+Mtc5Z0jkQq+gryjnF2eQwJVCQnugMFiPJnpCTqCsN+Upmds4syeVSlovz-EUKCdQ0J+FibtDJv6T0NcVydxBbE1VAqWbQqGfAqy-ogjEBFkwlcdpBQGuaEEVwhIMyCnMISV4NN8X6z5WquQSs5Z5zjpZO23iEBnO9pRZwIFN6BG8A3AkTtJJ+CtK6S1-81GcNPjgTV4lva40ou4YwkohretUJKO+OggjsucKGnlcFj60jWknIe7YlRdg8Toh1wqfFOWrYEKwnRfCekbRUIiNoai2n6A8EU1yw04NLX2gZmrAhFkDQcl0v0ghIOIqKama6nSbrCEAA */
|
||||
|
@ -136,8 +136,6 @@ import { uuidv4 } from '@src/lib/utils'
|
||||
import { deleteNodeInExtrudePipe } from '@src/lang/modifyAst/deleteNodeInExtrudePipe'
|
||||
import type { ImportStatement } from '@rust/kcl-lib/bindings/ImportStatement'
|
||||
|
||||
export const MODELING_PERSIST_KEY = 'MODELING_PERSIST_KEY'
|
||||
|
||||
export type SetSelections =
|
||||
| {
|
||||
selectionType: 'singleCodeCursor'
|
||||
@ -1135,7 +1133,6 @@ export const modelingMachine = setup({
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||
sceneEntitiesManager.createSketchAxis(
|
||||
sketchDetails.sketchEntryNodePath || [],
|
||||
sketchDetails.zAxis,
|
||||
sketchDetails.yAxis,
|
||||
sketchDetails.origin
|
||||
@ -4713,41 +4710,3 @@ export function pipeHasCircle({
|
||||
)
|
||||
return hasCircle
|
||||
}
|
||||
|
||||
export function canRectangleOrCircleTool({
|
||||
sketchDetails,
|
||||
}: {
|
||||
sketchDetails: SketchDetails | null
|
||||
}): boolean {
|
||||
const node = getNodeFromPath<VariableDeclaration>(
|
||||
kclManager.ast,
|
||||
sketchDetails?.sketchEntryNodePath || [],
|
||||
'VariableDeclaration'
|
||||
)
|
||||
// This should not be returning false, and it should be caught
|
||||
// but we need to simulate old behavior to move on.
|
||||
if (err(node)) return false
|
||||
return node.node?.declaration.init.type !== 'PipeExpression'
|
||||
}
|
||||
|
||||
/** If the sketch contains `close` or `circle` stdlib functions it must be closed */
|
||||
export function isClosedSketch({
|
||||
sketchDetails,
|
||||
}: {
|
||||
sketchDetails: SketchDetails | null
|
||||
}): boolean {
|
||||
const node = getNodeFromPath<VariableDeclaration>(
|
||||
kclManager.ast,
|
||||
sketchDetails?.sketchEntryNodePath || [],
|
||||
'VariableDeclaration'
|
||||
)
|
||||
// This should not be returning false, and it should be caught
|
||||
// but we need to simulate old behavior to move on.
|
||||
if (err(node)) return false
|
||||
if (node.node?.declaration?.init?.type !== 'PipeExpression') return false
|
||||
return node.node.declaration.init.body.some(
|
||||
(node) =>
|
||||
node.type === 'CallExpressionKw' &&
|
||||
(node.callee.name.name === 'close' || node.callee.name.name === 'circle')
|
||||
)
|
||||
}
|
||||
|
Reference in New Issue
Block a user