-
-
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
New implementation of finding the top level form range #1230
New implementation of finding the top level form range #1230
Conversation
7af1f7c
to
6785f93
Compare
Thanks! It looks a bit complicated. Maybe that is needed, but it seldom is, is my experience. For the uses where your first attempts falled I think it would be great to add some tests that demonstrate how it is working with the current implementation. I'm thinking that should probably be done on a branch of its own, straight of I also will try to add a bit better test coverage around the use cases involving the depth and So, that is maybe easiest if add this coverage on the same branch. I can give you commit access to the repo, if you are comfortable with that? |
Agreed. I also believe that it could (hopefully) be written in simpler way. I was just simply trying (perhaps too hard 😄) to end up with more-or-less same behavior as current I've been testing the VSIX for a while and I'm quite happy with the behavior. It's way faster and evaluation mostly seems to behave same as before. So far I found one issue and one thing I'm not sure about. First the issue: when scrolling in the editor, sometimes the Then there's a small difference in what should get evaluated, when your cursor is between two top level forms. For example consider these situations ( (println "foo")
|
(println "bar") (println "foo")
|
(println "bar") Now the
My branch
I'm not sure what's the expected behavior. Strictly speaking, when the cursor is not inside any list, nor is it "directly touching" any symbol, I'd expect that "it has no top-level form (or blank string is its top level form)" - and therefore nothing should get evaluated. On the other hand I can imagine that people already trained their muscle memory in that way, that they rely on current behavior.
That would be great. When you'll be adding those, can you cover the scenario I mentioned ^^^ ? And perhaps also some "most critical" scenarios when evaluating code in REPL window. Without some of the conditions in my code, REPL window worked in that way for me, that it kept evaluating last expression, when I pressed
I'm not sure I follow. commit access to which repo? Btw would you have any advice regarding some efficient workflow for running tests? So far I only executed them from command line using |
6785f93
to
415c521
Compare
Commited a yet another still-experimental version of Still, it will be interesting to see if it passes those tests we're going to create in |
I created a branch for adding tests for the current implementation. https://github.com/BetterThanTomorrow/calva/tree/1230-range-for-defun-tests Added some tests there, then realized I want them in |
@brdloush You can use the Mocha Test Explorer extension, which will give you a side panel for seeing and running tests, and will also add code lenses above tests for debugging them, so you can place a breakpoint and then click the code lens to debug a test. |
I've created yet another branch now: https://github.com/BetterThanTomorrow/calva/tree/defun-range-experiments 😄 The reason being that I wanted to see what holes there could be in the strategy you and I cooked up in that pair ”programming” session @brdloush. So far I've found no holes. (Not tested the performance, but I see no reason why it should be slow, even though, to keep it simple, we call In this branch there is increased test coverage which is also duplicated to the Maybe you should consider filing a new PR based on this branch, @brdloush. Clone the Calva repo if so and work from there, as you have push access now. (I've forgotten to inform you about that, @bpringe, but now that's fixed. 😄 ) Then we can coop on finishing this work. |
I have no problem with that. 😃 |
Closing this PR in favor of #1237 (ie. the one created from |
What has Changed?
Additional improvement for #942 (slow REPL window output).
I've traced down the main source of slowness being in
tlCursor.rangeForDefun
. According to PEZ:I started with following slack suggestion by PEZ and also tried to get some inspiration from
ctrl+alt+down
(Paredit Forward Up Sexp):This simple way looked fine first, but once I was trying different evaluations in editor (and in REPL window), it resulted in different/non-functioning behavior, compared to original "slow" version. Particularly I had issues with partial thread macro evals (
ctrl+alt+enter
), manyalt-enter
evals on different palces resulted in incorrect block being evaluated, evals inside repl windows acted a bit strangely etc.After many attempts of trial-and-error fixing, I now have a first draft that I'd like to testusing a
vsix
, thus creating a draft PR.It's very likely that the whole function may (should) be written in different way. It's a first attempt, I still don't have enough knowledge about all those different ways of navigation in documents/sexps etc. Consider this PR a POC for performance and regression testing.
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.[ ] Added to or updated docs in this branch, if appropriateci/circleci: build
test. NB: You need to sign in/up at Circle CI to find the Artifacts tab.[ ] If I am fixing the issue, I have used [GitHub's fixes/closes syntax](https://help.github.com/en/articles/closing-issues-using-keywords)[ ] Created the issue I am fixing/addressing, if it was not present.The Calva Team PR Checklist:
Before merging we (at least one of us) have:
dev
branch (unless reasons).Ping @PEZ, @bpringe