-
-
Notifications
You must be signed in to change notification settings - Fork 219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix currentTopLevelFunction function for metadata skipping #1466
Fix currentTopLevelFunction function for metadata skipping #1466
Conversation
Thanks! Some tests are failing now. Do you know how to run the tests locally? Let me know otherwise and I'll show you. |
@PEZ I see the failures. I'm investigating. I may need to solve this a different way. From reading the failed tests, I think I had an incorrect mental model of how forwardSexp was designed to operate over metadata and reader tags. |
This reverts commit a6dcca1.
Those parts are quite messy. We should clean it up some day. |
@PEZ I've reverted the original change and instead made the change in |
I'm having a look and a think about this. You have probably found the right place to do this, but at the same time this function is also very central to a lot of things. And the current tests do pass. I just need to experiment and think a bit. Please don't hesitate to bump this if I go silent for more than a few days. |
Right so I did go silent... But now have had a look and a think. This seems like the right way to solve the problem so I am going to go ahead and merge. Many thanks for helping in improving Calva! |
What has Changed?
- This PR updates the forwardSexp function for the case where there exists metadata between twoid
nodes andskipMetadata==true
. Previously, this function would move forward through whitespace and metadata, finally landing on anid
node. However, in theswitch (token.type) ... case 'id'
code there would be one final call tothis.next()
, thereby moving the cursor past the correct s-expr.- Now, theswitch (token.type) ... case 'id'
scenario has been updated to differentiate between:- the initial iteration of the while loop, where the cursor is still on the originalid
node, and it is correct to move past this originalid
node- any subsequent iteration of the loop, where it is not correct to move the cursor past the currentid
nodeUpdate:
currentTopLevelFunction
.currentTopLevelFunction
by checking whether the cursor is on metadata, and, if so, moves forward viafowardSexp
until a non-metadata node is found. It is a simpler, more specific solution than the first attempt.Fixes #1463
My Calva PR Checklist
I have:
dev
branch. (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.ci/circleci: build
test.- [ ] If I am fixing just part of the issue, I have just referenced it w/o any of the "fixes” keywords.Ping @PEZ, @bpringe