Add pair selecting support for cond forms #2992
Open
+97
−17
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What has changed?
This PR adds pair selecting behavior for
condformsImplementation
conditionalFormsconstant to identify forms that have test/expr pairsgetConditionalFormPairOffset()function to handle offset requirementsisInPairsList()to detectcondforms in listscurrentSexpsRange()to usepairOffsetwhen calculating pair indicescondform pair selectionStatus
Currently implemented:
cond- fully working with testscaseandcondpshould be included with other issue/PR because they can be different (defaults, result-expr or result-fn, etc.)Why This Approach
Rather than hardcoding offset values directly in the pairing logic, we:
getConditionalFormPairOffset()function that determines the offset dynamically based on the form type. This makes easier to add more conditional forms in the futurecurrentSexpsRange()logic clean and maintainableAlternative Considered
Could have created separate functions for each form type, but this would duplicate logic. The offset approach is more maintainable.
Fixes #2991
My Calva PR Checklist
I have:
devbranch. (Or have specific reasons to target some other branch.)published. (Sorry for the nagging.)[Unreleased]entry inCHANGELOG.md, linking the issue(s) that the PR is addressing.npm run prettier-format)npm run eslintbefore creating your PR, or runnpm run eslint-watchto eslint as you go.)