Skip to content

Commit

Permalink
Add test for making sure the ignore marker is not included in top lev…
Browse files Browse the repository at this point in the history
…el form selection

* Fixes #2655
  • Loading branch information
PEZ committed Oct 29, 2024
1 parent 6b6d861 commit 93def6b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
14 changes: 14 additions & 0 deletions src/extension-test/unit/cursor-doc/token-cursor-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)');
Expand Down Expand Up @@ -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]);
});
});
});

Expand Down

0 comments on commit 93def6b

Please sign in to comment.