[BUG] mutate ast to keep comments for pipe split ast-mod (#6128)

* mutate ast to keep comments

* remove commented out code

* fix case where no comments in split
This commit is contained in:
Kurt Hutten
2025-04-04 14:01:23 +11:00
committed by GitHub
parent 1a59fc4f99
commit d270447777
4 changed files with 56 additions and 30 deletions

View File

@ -1030,19 +1030,25 @@ sketch003 = startSketchOn(XZ)
describe('Testing splitPipedProfile', () => {
it('should split the pipe expression correctly', () => {
const codeBefore = `part001 = startSketchOn(XZ)
const codeBefore = `// comment 1
part001 = startSketchOn(XZ)
|> startProfileAt([1, 2], %)
// comment 2
|> line([3, 4], %)
|> line([5, 6], %)
|> close(%)
// comment 3
extrude001 = extrude(5, part001)
`
const expectedCodeAfter = `sketch001 = startSketchOn(XZ)
const expectedCodeAfter = `// comment 1
sketch001 = startSketchOn(XZ)
part001 = startProfileAt([1, 2], sketch001)
// comment 2
|> line([3, 4], %)
|> line([5, 6], %)
|> close(%)
// comment 3
extrude001 = extrude(5, part001)
`