Skip to content
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

Comment aware eval top #333

Merged
merged 5 commits into from
Apr 25, 2021
Merged

Conversation

pinealan
Copy link
Contributor

Modifies the behavior of :IcedEvalOuterTopList and Plug(iced_eval_outer_top_list) when the cursor is inside forms that have a root comment form. Evaluation will be of the topmost form inside the comment, instead of evaluating all forms in the comment as a do.

When the cursor is directly inside the comment form, the current behavior of eval as do is preserved.

As example to illustrate:

(comment
  (print (📍"Hello"))
  (print ("world")))
; => hello

(comment
📍(print ("hello"))
  (print ("world")))
; => helloworld

@codecov-commenter
Copy link

codecov-commenter commented Apr 24, 2021

Codecov Report

Merging #333 (526121b) into main (0a96584) will decrease coverage by 0.11%.
The diff coverage is 60.41%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #333      +/-   ##
==========================================
- Coverage   77.41%   77.30%   -0.12%     
==========================================
  Files          74       74              
  Lines        6687     6733      +46     
==========================================
+ Hits         5177     5205      +28     
- Misses       1510     1528      +18     
Impacted Files Coverage Δ
autoload/iced/socket_repl.vim 44.37% <0.00%> (ø)
autoload/iced/paredit.vim 82.38% <60.86%> (-6.74%) ⬇️
autoload/iced/nrepl/eval.vim 85.27% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0a96584...526121b. Read the comment docs.

Copy link
Owner

@liquidz liquidz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pinealan Thanks for your great work!
Overall looks good :)

autoload/iced/paredit.vim Outdated Show resolved Hide resolved
autoload/iced/paredit.vim Outdated Show resolved Hide resolved
@@ -819,8 +819,7 @@ COMMANDS *vim-iced-commands*

*:IcedEvalOuterTopList*
:IcedEvalOuterTopList
Work same as `<Plug>(iced_eval)<Plug>(sexp_outer_top_list)`,
without scrolling.
Evaluate topmost form that is not a comment where the cursor currently is.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may be helpful there is an examples like the following.
https:/liquidz/vim-iced/blob/3.1.3/doc/vim-iced.txt#L400

Also if you don't mind, could you update the following document page?
https:/liquidz/vim-iced/blob/3.1.3/doc/pages/configuration/evaluation.adoc#evaluation

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, I've put the example in the adoc and linked to it from vim doc

@pinealan pinealan requested a review from liquidz April 25, 2021 14:11
Copy link
Owner

@liquidz liquidz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pinealan Awesome! Thank you so much.

I'll cut a new release.

@liquidz liquidz merged commit 04892cf into liquidz:main Apr 25, 2021
@pinealan pinealan deleted the comment-aware-eval-top branch April 26, 2021 02:51
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.

3 participants