diff --git a/CHANGELOG.md b/CHANGELOG.md index 51bcba681..f5a014b01 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ Changes to Calva. - [Add extension when contexts for Calva states such as project root, session type, ns](https://github.com/BetterThanTomorrow/calva/issues/2652) - Fix: [Calva internals: The `backwardSexp` function can't handle skipping ignored forms, even though it says it can](https://github.com/BetterThanTomorrow/calva/issues/2657) +- Fix: [Keep support for evaluating top level form in ignored forms when at top level](https://github.com/BetterThanTomorrow/calva/issues/2655) ## [2.0.480] - 2024-10-21 diff --git a/src/extension-test/unit/cursor-doc/token-cursor-test.ts b/src/extension-test/unit/cursor-doc/token-cursor-test.ts index b89cc9ab5..2bd377d6e 100644 --- a/src/extension-test/unit/cursor-doc/token-cursor-test.ts +++ b/src/extension-test/unit/cursor-doc/token-cursor-test.ts @@ -804,6 +804,13 @@ describe('Token Cursor', () => { const cursor: LispTokenCursor = a.getTokenCursor(a.selections[0].active); expect(cursor.rangeForDefun(a.selections[0].active)).toEqual(textAndSelection(b)[1]); }); + // https://github.com/BetterThanTomorrow/calva/issues/2655 + it('Does not include ignore marker', () => { + const a = docFromTextNotation('a #_ [b (c|)] [d]'); + const b = docFromTextNotation('a #_ |[b (c)]| [d]'); + const cursor: LispTokenCursor = a.getTokenCursor(a.selections[0].active); + expect(cursor.rangeForDefun(a.selections[0].active)).toEqual(textAndSelection(b)[1]); + }); describe('Rich Comment Form top level context', () => { it('Finds range for a top level form inside a comment', () => { const a = docFromTextNotation('aaa (comment [bbb cc|c] ddd)'); @@ -954,6 +961,13 @@ describe('Token Cursor', () => { const cursor: LispTokenCursor = a.getTokenCursor(0); expect(cursor.rangeForDefun(a.selections[0].anchor)).toEqual(textAndSelection(b)[1]); }); + // https://github.com/BetterThanTomorrow/calva/issues/2655 + it('Does not include ignore marker', () => { + const a = docFromTextNotation('aaa (comment #_ [bbb ccc|] ddd)'); + const b = docFromTextNotation('aaa (comment #_ |[bbb ccc]| ddd)'); + const cursor: LispTokenCursor = a.getTokenCursor(a.selections[0].active); + expect(cursor.rangeForDefun(a.selections[0].active)).toEqual(textAndSelection(b)[1]); + }); }); });