Skip to content

Conversation

@jramosg
Copy link

@jramosg jramosg commented Jan 20, 2026

What has changed?

  • Update isInPairsList to recognize :let vectors within binding forms
  • Add unit tests for :let selection behavior

Fixes #2988

My Calva PR Checklist

I have:

  • Read How to Contribute.
  • Directed this pull request at the dev branch. (Or have specific reasons to target some other branch.)
  • Made sure I have changed the PR base branch, so that it is not published. (Sorry for the nagging.)
  • Made sure there is an issue registered with a clear problem statement that this PR addresses, (created the issue if it was not present).
    • Updated the [Unreleased] entry in CHANGELOG.md, linking the issue(s) that the PR is addressing.
  • Figured if anything about the fix warrants tests on Mac/Linux/Windows/Remote/Whatever, and either tested it there if so, or mentioned it in the PR.
  • Added to or updated docs in this branch, if appropriate
  • Tests
    • Tested the particular change
    • Figured if the change might have some side effects and tested those as well.
  • Formatted all JavaScript and TypeScript code that was changed. (use the prettier extension or run npm run prettier-format)
  • Confirmed that there are no linter warnings or errors (use the eslint extension, run npm run eslint before creating your PR, or run npm run eslint-watch to eslint as you go).

@netlify
Copy link

netlify bot commented Jan 20, 2026

Deploy Preview for calva-docs ready!

Name Link
🔨 Latest commit 187678e
🔍 Latest deploy log https://app.netlify.com/projects/calva-docs/deploys/696f8f52c92b7300084ae556
😎 Deploy Preview https://deploy-preview-2989--calva-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@jramosg jramosg changed the title Fix grow selection for :let bindings in for loops Fix grow selection for :let bindingsl oops Jan 20, 2026
@jramosg jramosg changed the title Fix grow selection for :let bindingsl oops Fix grow selection for :let bindings loops Jan 20, 2026
@jramosg jramosg marked this pull request as draft January 20, 2026 11:47
@PEZ
Copy link
Collaborator

PEZ commented Jan 20, 2026

Looks great so far! Thanks for doing this! 🙏 ❤️

- Fixed isInPairsList to properly detect :let vectors by calling isPrecededByLetVector helper
- Improved growSelection to check binding pairs before expanding to whole list
- Added length comparison to only expand to pair when current selection is smaller
- Updated currentSexpsRange to use fresh cursor for correct list context
- Added comprehensive tests for :let binding pair selection

Fixes BetterThanTomorrow#2988
Updated the function name from isPrecededByLetVector to
isPrecededByLetKeyword for clarity. Enhanced the logic to skip
comments while checking for the preceding :let keyword, ensuring
more accurate detection in various contexts.
This commit introduces new test cases to verify the behavior of the
growSelection function when dealing with :let binding pairs within
doseq constructs. The tests ensure that the selection correctly
expands to include the appropriate binding pairs and the entire
binding box, enhancing the robustness of the selection handling.
@jramosg jramosg marked this pull request as ready for review January 20, 2026 14:03
Fix grow selection to consider "form pairs" in :let bindings,
aligning behavior with standard let functionality. This change
addresses issue BetterThanTomorrow#2988 and improves user experience when
working with selections in Clojure code.
This test verifies that the growSelection function correctly handles
binding pairs in :let expressions, including cases with comments
interspersed. It ensures that the selection behavior is consistent
and accurate for various scenarios involving comments.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants