Automatic fixing of deprecations and use non-quoted default planes by default (#5902)

* Automatic fixing of deprecations and use non-quoted default planes by default

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* A snapshot a day keeps the bugs away! 📷🐛

* A snapshot a day keeps the bugs away! 📷🐛

* A snapshot a day keeps the bugs away! 📷🐛

* A snapshot a day keeps the bugs away! 📷🐛

* A snapshot a day keeps the bugs away! 📷🐛

---------

Signed-off-by: Nick Cameron <nrc@ncameron.org>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
Nick Cameron
2025-03-21 22:39:12 +13:00
committed by GitHub
parent 06b35b76ff
commit e8feb0309b
235 changed files with 1227 additions and 1097 deletions

View File

@ -42,7 +42,7 @@ test.describe('Sketch tests', { tag: ['@skipWin'] }, () => {
wireRadius = 2
wireOffset = 0.5
screwHole = startSketchOn('XY')
screwHole = startSketchOn(XY)
${startProfileAt1}
|> arc({
radius = screwRadius,
@ -50,7 +50,7 @@ test.describe('Sketch tests', { tag: ['@skipWin'] }, () => {
angleEnd = 360
}, %)
part001 = startSketchOn('XY')
part001 = startSketchOn(XY)
${startProfileAt2}
|> xLine(length = width * .5)
|> yLine(length = height)
@ -59,7 +59,7 @@ test.describe('Sketch tests', { tag: ['@skipWin'] }, () => {
|> hole(screwHole, %)
|> extrude(length = thickness)
part002 = startSketchOn('-XZ')
part002 = startSketchOn(-XZ)
${startProfileAt3}
|> xLine(length = width / 4)
|> tangentialArcTo([width / 2, 0], %)
@ -113,7 +113,7 @@ test.describe('Sketch tests', { tag: ['@skipWin'] }, () => {
await page.addInitScript(async () => {
localStorage.setItem(
'persistCode',
`sketch001 = startSketchOn('XZ')
`sketch001 = startSketchOn(XZ)
|> startProfileAt([2.61, -4.01], %)
|> xLine(length = 8.73)
|> tangentialArcTo([8.33, -1.31], %)`
@ -159,7 +159,7 @@ test.describe('Sketch tests', { tag: ['@skipWin'] }, () => {
await page.mouse.click(700, 200)
await expect.poll(u.normalisedEditorCode, { timeout: 1000 })
.toBe(`sketch002 = startSketchOn('XZ')
.toBe(`sketch002 = startSketchOn(XZ)
sketch001 = startProfileAt([12.34, -12.34], sketch002)
|> yLine(length = 12.34)
@ -203,7 +203,7 @@ sketch001 = startProfileAt([12.34, -12.34], sketch002)
await page.addInitScript(async () => {
localStorage.setItem(
'persistCode',
`sketch001 = startSketchOn('XZ')
`sketch001 = startSketchOn(XZ)
|> startProfileAt([4.61, -14.01], %)
|> line(end = [12.73, -0.09])
|> tangentialArcTo([24.95, -5.38], %)
@ -253,7 +253,7 @@ sketch001 = startProfileAt([12.34, -12.34], sketch002)
// If we have the code pane open, we should see the code.
if (openPanes.includes('code')) {
await expect(u.codeLocator).toHaveText(`sketch001 = startSketchOn('XZ')
await expect(u.codeLocator).toHaveText(`sketch001 = startSketchOn(XZ)
|> startProfileAt([4.61, -14.01], %)
|> line(end = [12.73, -0.09])
|> tangentialArcTo([24.95, -5.38], %)
@ -398,7 +398,7 @@ sketch001 = startProfileAt([12.34, -12.34], sketch002)
// expect the code to have changed
await expect(page.locator('.cm-content'))
.toHaveText(`sketch001 = startSketchOn('XZ')
.toHaveText(`sketch001 = startSketchOn(XZ)
|> startProfileAt([6.44, -12.07], %)
|> line(end = [14.72, 1.97])
|> tangentialArcTo([26.92, -3.32], %)
@ -475,7 +475,7 @@ sketch001 = startProfileAt([12.34, -12.34], sketch002)
await page.addInitScript(async () => {
localStorage.setItem(
'persistCode',
`sketch001 = startSketchOn('XZ')
`sketch001 = startSketchOn(XZ)
|> circle(center = [4.61, -5.01], radius = 8)`
)
})
@ -552,7 +552,7 @@ sketch001 = startProfileAt([12.34, -12.34], sketch002)
// expect the code to have changed
await editor.expectEditor.toContain(
`sketch001 = startSketchOn('XZ')
`sketch001 = startSketchOn(XZ)
|> circle(center = [7.26, -2.37], radius = 11.44)`,
{ shouldNormalise: true }
)
@ -565,7 +565,7 @@ sketch001 = startProfileAt([12.34, -12.34], sketch002)
await page.addInitScript(async () => {
localStorage.setItem(
'persistCode',
`sketch001 = startSketchOn('XZ')
`sketch001 = startSketchOn(XZ)
|> startProfileAt([4.61, -10.01], %)
|> line(end = [12.73, -0.09])
|> tangentialArcTo([24.95, -0.38], %)
@ -651,7 +651,7 @@ sketch001 = startProfileAt([12.34, -12.34], sketch002)
// expect the code to have changed
await expect(page.locator('.cm-content'))
.toHaveText(`sketch001 = startSketchOn('XZ')
.toHaveText(`sketch001 = startSketchOn(XZ)
|> startProfileAt([7.12, -12.68], %)
|> line(end = [12.68, -1.09])
|> tangentialArcTo([24.89, 0.68], %)
@ -669,7 +669,7 @@ sketch001 = startProfileAt([12.34, -12.34], sketch002)
await page.addInitScript(async () => {
localStorage.setItem(
'persistCode',
`sketch001 = startSketchOn('XZ')
`sketch001 = startSketchOn(XZ)
|> startProfileAt([4.61, -14.01], %)
|> line(end = [12.73, -0.09])
|> tangentialArcTo([24.95, -5.38], %)
@ -755,7 +755,7 @@ sketch001 = startProfileAt([12.34, -12.34], sketch002)
// expect the code to have changed
await expect(page.locator('.cm-content'))
.toHaveText(`sketch001 = startSketchOn('XZ')
.toHaveText(`sketch001 = startSketchOn(XZ)
|> startProfileAt([6.44, -12.07], %)
|> line(end = [14.72, 1.97])
|> tangentialArcTo([24.95, -5.38], %)
@ -789,7 +789,7 @@ sketch001 = startProfileAt([12.34, -12.34], sketch002)
200
)
let codeStr = "sketch001 = startSketchOn('XY')"
let codeStr = 'sketch001 = startSketchOn(XY)'
await page.mouse.click(center.x, viewportSize.height * 0.55)
await expect(u.codeLocator).toHaveText(codeStr)
@ -828,7 +828,7 @@ sketch001 = startProfileAt([12.34, -12.34], sketch002)
// so selecting the plane again is a bit easier.
await page.mouse.click(center.x + 200, center.y + 100)
await page.waitForTimeout(600) // TODO detect animation ending, or disable animation
codeStr += "sketch002 = startSketchOn('XY')"
codeStr += 'sketch002 = startSketchOn(XY)'
await expect(u.codeLocator).toHaveText(codeStr)
await u.closeDebugPanel()
@ -868,7 +868,7 @@ sketch001 = startProfileAt([12.34, -12.34], sketch002)
await u.openDebugPanel()
const code = `sketch001 = startSketchOn('-XZ')
const code = `sketch001 = startSketchOn(-XZ)
profile001 = startProfileAt([${roundOff(scale * 69.6)}, ${roundOff(
scale * 34.8
)}], sketch001)
@ -898,7 +898,7 @@ profile001 = startProfileAt([${roundOff(scale * 69.6)}, ${roundOff(
await page.mouse.move(700, 200, { steps: 10 })
await page.mouse.click(700, 200, { delay: 200 })
await expect(page.locator('.cm-content')).toHaveText(
`sketch001 = startSketchOn('-XZ')`
`sketch001 = startSketchOn(-XZ)`
)
let prevContent = await page.locator('.cm-content').innerText()
@ -973,7 +973,7 @@ profile001 = startProfileAt([${roundOff(scale * 69.6)}, ${roundOff(
await page.addInitScript(async () => {
localStorage.setItem(
'persistCode',
`sketch001 = startSketchOn('XZ')
`sketch001 = startSketchOn(XZ)
|> startProfileAt([-0.45, 0.87], %)
|> line(end = [1.32, 0.38])
|> line(end = [1.02, -1.32], tag = $seg01)
@ -1031,7 +1031,7 @@ profile001 = startProfileAt([${roundOff(scale * 69.6)}, ${roundOff(
await page.addInitScript(async () => {
localStorage.setItem(
'persistCode',
`sketch001 = startSketchOn('XZ')
`sketch001 = startSketchOn(XZ)
|> startProfileAt([-0.45, 0.87], %)
|> line(end = [1.32, 0.38])
|> line(end = [1.02, -1.32], tag = $seg01)
@ -1074,7 +1074,7 @@ profile001 = startProfileAt([${roundOff(scale * 69.6)}, ${roundOff(
).toBeVisible()
await expect((await u.codeLocator.innerText()).replace(/\s/g, '')).toBe(
`sketch001 = startSketchOn('XZ')
`sketch001 = startSketchOn(XZ)
|> startProfileAt([-0.45, 0.87], %)
|> line(end = [1.32, 0.38])
|> line(end = [1.02, -1.32], tag = $seg01)
@ -1127,7 +1127,7 @@ profile001 = startProfileAt([${roundOff(scale * 69.6)}, ${roundOff(
await u.openAndClearDebugPanel()
await u.codeLocator.fill(`sketch001 = startSketchOn('XY')
await u.codeLocator.fill(`sketch001 = startSketchOn(XY)
|> startProfileAt([-10, -10], %)
|> line(end = [20, 0])
|> line(end = [0, 20])
@ -1166,7 +1166,7 @@ profile001 = startProfileAt([${roundOff(scale * 69.6)}, ${roundOff(
await page.mouse.click(XYPlanePoint.x, XYPlanePoint.y)
await page.waitForTimeout(200)
await page.mouse.click(XYPlanePoint.x + 50, XYPlanePoint.y + 50)
await expect(u.codeLocator).toHaveText(`sketch001 = startSketchOn('XZ')
await expect(u.codeLocator).toHaveText(`sketch001 = startSketchOn(XZ)
|> startProfileAt([11.8, 9.09], %)
|> line(end = [3.39, -3.39])
`)
@ -1174,7 +1174,7 @@ profile001 = startProfileAt([${roundOff(scale * 69.6)}, ${roundOff(
await page.addInitScript(async () => {
localStorage.setItem(
'persistCode',
`sketch001 = startSketchOn('XZ')
`sketch001 = startSketchOn(XZ)
|> startProfileAt([11.8, 9.09], %)
|> line(end = [3.39, -3.39])
`
@ -1214,7 +1214,7 @@ profile001 = startProfileAt([${roundOff(scale * 69.6)}, ${roundOff(
return lugSketch
}
lug([0, 0], 10, .5, "XY")`
lug([0, 0], 10, .5, XY)`
)
})
@ -1273,7 +1273,7 @@ profile001 = startProfileAt([${roundOff(scale * 69.6)}, ${roundOff(
const railBaseLength = in2mm(.200)
const railClampable = in2mm(.200)
const rail = startSketchOn('XZ')
const rail = startSketchOn(XZ)
|> startProfileAt([
-railTop / 2,
railClampable + railBaseLength
@ -1426,7 +1426,7 @@ test.describe(`Sketching with offset planes`, () => {
await context.addInitScript(() => {
localStorage.setItem(
'persistCode',
`offsetPlane001 = offsetPlane("XY", offset = 10)`
`offsetPlane001 = offsetPlane(XY, offset = 10)`
)
})
@ -1440,9 +1440,9 @@ test.describe(`Sketching with offset planes`, () => {
await test.step(`Hovering should highlight code`, async () => {
await planeHover()
await editor.expectState({
activeLines: [`offsetPlane001=offsetPlane("XY",offset=10)`],
activeLines: [`offsetPlane001=offsetPlane(XY,offset=10)`],
diagnostics: [],
highlightedCode: 'offsetPlane("XY", offset = 10)',
highlightedCode: 'offsetPlane(XY, offset = 10)',
})
})
@ -1453,7 +1453,7 @@ test.describe(`Sketching with offset planes`, () => {
await expect(toolbar.lineBtn).toBeEnabled()
await editor.expectEditor.toContain('startSketchOn(offsetPlane001)')
await editor.expectState({
activeLines: [`offsetPlane001=offsetPlane("XY",offset=10)`],
activeLines: [`offsetPlane001=offsetPlane(XY,offset=10)`],
diagnostics: [],
highlightedCode: '',
})
@ -1473,7 +1473,7 @@ test.describe('multi-profile sketching', () => {
localStorage.setItem(
'persistCode',
`yo = 5
sketch001 = startSketchOn('XZ')
sketch001 = startSketchOn(XZ)
profile001 = startProfileAt([121.52, 168.25], sketch001)
|> line(end = [115.04, 113.61])
|> line(end = [130.87, -97.79])
@ -1604,7 +1604,7 @@ profile002 = startProfileAt([117.2, 56.08], sketch001)
await context.addInitScript(() => {
localStorage.setItem(
'persistCode',
`sketch001 = startSketchOn('XZ')
`sketch001 = startSketchOn(XZ)
profile002 = startProfileAt([40.68, 87.67], sketch001)
|> xLine(length = 239.17)
profile003 = startProfileAt([206.63, -56.73], sketch001)
@ -1683,7 +1683,7 @@ profile003 = startProfileAt([206.63, -56.73], sketch001)
await page.addInitScript(async () => {
localStorage.setItem(
'persistCode',
`sketch001 = startSketchOn('XY')
`sketch001 = startSketchOn(XY)
`
)
})
@ -1733,7 +1733,7 @@ profile003 = startProfileAt([206.63, -56.73], sketch001)
await selectXZPlane()
// timeout wait for engine animation is unavoidable
await page.waitForTimeout(600)
await editor.expectEditor.toContain(`sketch001 = startSketchOn('XZ')`)
await editor.expectEditor.toContain(`sketch001 = startSketchOn(XZ)`)
const [startProfile1] = scene.makeMouseHelpers(568, 70)
const [segment1Clk] = scene.makeMouseHelpers(701, 78)
@ -1751,7 +1751,7 @@ profile003 = startProfileAt([206.63, -56.73], sketch001)
})
await test.step('delete all profiles', async () => {
await editor.replaceCode('', "sketch001 = startSketchOn('XZ')\n")
await editor.replaceCode('', 'sketch001 = startSketchOn(XZ)\n')
await page.waitForTimeout(600) // wait for deferred execution
})
@ -1834,7 +1834,7 @@ profile003 = startProfileAt([206.63, -56.73], sketch001)
await selectXZPlane()
// timeout wait for engine animation is unavoidable
await page.waitForTimeout(600)
await editor.expectEditor.toContain(`sketch001 = startSketchOn('XZ')`)
await editor.expectEditor.toContain(`sketch001 = startSketchOn(XZ)`)
await test.step('Create a close profile stopping mid profile to equip the tangential arc, then three-point arc, and then back to the line tool', async () => {
await startProfile1()
await editor.expectEditor.toContain(
@ -2172,7 +2172,7 @@ profile003 = startProfileAt([206.63, -56.73], sketch001)
await page.addInitScript(async () => {
localStorage.setItem(
'persistCode',
`sketch001 = startSketchOn('XZ')
`sketch001 = startSketchOn(XZ)
profile001 = startProfileAt([6.24, 4.54], sketch001)
|> line(end = [-0.41, 6.99])
|> line(end = [8.61, 0.74])
@ -2317,7 +2317,7 @@ profile004 = circleThreePoint(sketch001, p1 = [13.44, -6.8], p2 = [13.39, -2.07]
await page.addInitScript(async () => {
localStorage.setItem(
'persistCode',
`sketch001 = startSketchOn('XZ')
`sketch001 = startSketchOn(XZ)
profile001 = startProfileAt([6.24, 4.54], sketch001)
|> line(end = [-0.41, 6.99])
|> line(end = [8.61, 0.74])
@ -2422,7 +2422,7 @@ profile003 = circle(sketch001, center = [6.92, -4.2], radius = 3.16)
await page.addInitScript(async () => {
localStorage.setItem(
'persistCode',
`sketch001 = startSketchOn('XZ')
`sketch001 = startSketchOn(XZ)
profile001 = startProfileAt([-63.43, 193.08], sketch001)
|> line(end = [168.52, 149.87])
|> line(end = [190.29, -39.18])
@ -2504,16 +2504,16 @@ extrude001 = extrude(profile003, length = 5)
// timeout wait for engine animation is unavoidable
await page.waitForTimeout(600)
await editor.expectEditor.toContain(`sketch001 = startSketchOn('XZ')`)
await editor.expectEditor.toContain(`sketch001 = startSketchOn(XZ)`)
await toolbar.exitSketch()
await editor.expectEditor.not.toContain(`sketch001 = startSketchOn('XZ')`)
await editor.expectEditor.not.toContain(`sketch001 = startSketchOn(XZ)`)
await test.step("still renders code, hasn't got into a weird state", async () => {
await editor.replaceCode(
'myVar = 5',
`myVar = 5
sketch001 = startSketchOn('XZ')
sketch001 = startSketchOn(XZ)
profile001 = circle(
sketch001,
center = [12.41, 3.87],
@ -2533,13 +2533,13 @@ extrude001 = extrude(profile003, length = 5)
await page.addInitScript(async () => {
localStorage.setItem(
'persistCode',
`sketch001 = startSketchOn('XZ')
`sketch001 = startSketchOn(XZ)
profile001 = startProfileAt([85.19, 338.59], sketch001)
|> line(end = [213.3, -94.52])
|> line(end = [-230.09, -55.34])
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
sketch002 = startSketchOn('XY')
sketch002 = startSketchOn(XY)
profile002 = startProfileAt([85.81, 52.55], sketch002)
`
@ -2575,7 +2575,7 @@ profile002 = startProfileAt([85.81, 52.55], sketch002)
await page.addInitScript(async () => {
localStorage.setItem(
'persistCode',
`thePart = startSketchOn('XZ')
`thePart = startSketchOn(XZ)
|> startProfileAt([7.53, 10.51], %)
|> line(end = [12.54, 1.83])
|> line(end = [6.65, -6.91])
@ -2606,14 +2606,14 @@ extrude001 = extrude(thePart, length = 75)
await test.step('expect code to match initial conditions still', async () => {
await editor.expectEditor.toContain(
`thePart = startSketchOn('XZ') |> startProfileAt([7.53, 10.51], %)`
`thePart = startSketchOn(XZ) |> startProfileAt([7.53, 10.51], %)`
)
})
await test.step('equiping the line tool should break up the pipe expression', async () => {
await toolbar.lineBtn.click()
await editor.expectEditor.toContain(
`sketch001 = startSketchOn('XZ')thePart = startProfileAt([7.53, 10.51], sketch001)`
`sketch001 = startSketchOn(XZ)thePart = startProfileAt([7.53, 10.51], sketch001)`
)
})
@ -2636,7 +2636,7 @@ extrude001 = extrude(thePart, length = 75)
await page.addInitScript(async () => {
localStorage.setItem(
'persistCode',
`sketch001 = startSketchOn('XZ')
`sketch001 = startSketchOn(XZ)
profile001 = startProfileAt([6.71, -3.66], sketch001)
|> line(end = [2.65, 9.02], tag = $seg02)
|> line(end = [3.73, -9.36], tag = $seg01)
@ -2676,7 +2676,7 @@ revolve001 = revolve(
axis = getNextAdjacentEdge(seg01)
)
extrude002 = extrude(profile006, length = 4)
sketch003 = startSketchOn('-XZ')
sketch003 = startSketchOn(-XZ)
profile007 = startProfileAt([4.8, 7.55], sketch003)
|> line(end = [7.39, 2.58])
|> line(end = [7.02, -2.85])
@ -2809,13 +2809,13 @@ extrude003 = extrude(profile011, length = 2.5)
await page.addInitScript(async () => {
localStorage.setItem(
'persistCode',
`sketch001 = startSketchOn('XZ')
`sketch001 = startSketchOn(XZ)
profile001 = startProfileAt([34, 42.66], sketch001)
|> line(end = [102.65, 151.99])
|> line(end = [76, -138.66])
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
plane001 = offsetPlane('XZ', offset = 50)
plane001 = offsetPlane(XZ, offset = 50)
sketch002 = startSketchOn(plane001)
profile002 = startProfileAt([39.43, 172.21], sketch002)
|> xLine(length = 183.99)
@ -2867,13 +2867,13 @@ loft([profile001, profile002])
await page.addInitScript(async () => {
localStorage.setItem(
'persistCode',
`sketch001 = startSketchOn('XZ')
`sketch001 = startSketchOn(XZ)
profile001 = startProfileAt([34, 42.66], sketch001)
|> line(end = [102.65, 151.99])
|> line(end = [76, -138.66])
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
plane001 = offsetPlane('XZ', offset = 50)
plane001 = offsetPlane(XZ, offset = 50)
sketch002 = startSketchOn(plane001)
profile002 = startProfileAt([39.43, 172.21], sketch002)
|> xLine(length = 183.99)
@ -2943,7 +2943,7 @@ test.describe(`Click based selection don't brick the app when clicked out of ran
await context.addInitScript(() => {
localStorage.setItem(
'persistCode',
`sketch001 = startSketchOn('XZ')
`sketch001 = startSketchOn(XZ)
|> startProfileAt([0, 0], %)
|> line(end = [3.14, 3.14])
|> arcTo({
@ -2981,7 +2981,7 @@ test.describe(`Click based selection don't brick the app when clicked out of ran
// Check that the code is highlighted
await editor.expectState({
activeLines: ["sketch001=startSketchOn('XZ')"],
activeLines: ['sketch001=startSketchOn(XZ)'],
diagnostics: [],
highlightedCode: 'arcTo({end = [4, 2], interior = [1, 2]}, %)',
})
@ -2992,7 +2992,7 @@ test.describe(`Click based selection don't brick the app when clicked out of ran
await page.mouse.move(655, 337)
await editor.expectState({
activeLines: ["sketch001=startSketchOn('XZ')"],
activeLines: ['sketch001=startSketchOn(XZ)'],
diagnostics: [],
highlightedCode: '',
})
@ -3025,7 +3025,7 @@ test.describe('Redirecting to home page and back to the original file should cle
await context.addInitScript(() => {
localStorage.setItem(
'persistCode',
` sketch001 = startSketchOn('XZ')
` sketch001 = startSketchOn(XZ)
|> startProfileAt([256.85, 14.41], %)
|> line(endAbsolute = [0, 211.07])
`