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

Add documentation to embed an nREPL, specifically for Rebel Readline #285

Merged
merged 7 commits into from
Jan 31, 2021

Conversation

Futurile
Copy link
Contributor

Rebel Readline (https://github.com/bhauman/rebel-readline) is a user-friendly REPL that goes well with vim-iced. It only has a local service, so you have to create an nREPL after it's been started. This means you have to embed an nREPL.

It would be nicer to create an nREPL service in Rebel Readline, but it's too complicated!

Added documentation and example 'user.clj'.

@agriffis came up with this solution at clojure-emacs/cider-nrepl#447 (comment)

Rebel Readline (https://github.com/bhauman/rebel-readline) is a user-friendly REPL that goes well with vim-iced. It only has a local service, so you have to create an nREPL after it's been started. This means you have to embed an nREPL. 

 It would be nicer to create an nREPL service in Rebel Readline, but it's too complicated!

Added documentation and example 'user.clj'.
@codecov-io
Copy link

codecov-io commented Oct 25, 2020

Codecov Report

Merging #285 (40abf77) into main (9572616) will decrease coverage by 1.86%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #285      +/-   ##
==========================================
- Coverage   80.77%   78.90%   -1.87%     
==========================================
  Files          70       73       +3     
  Lines        6008     6396     +388     
==========================================
+ Hits         4853     5047     +194     
- Misses       1155     1349     +194     
Impacted Files Coverage Δ
autoload/iced/component/clj_kondo.vim 65.23% <0.00%> (-17.33%) ⬇️
autoload/iced/nrepl/debug.vim 77.50% <0.00%> (-14.81%) ⬇️
autoload/iced/nrepl/op/iced.vim 79.00% <0.00%> (-6.72%) ⬇️
autoload/iced/component/popup/vim.vim 65.97% <0.00%> (-6.31%) ⬇️
autoload/iced/component/virtual_text/vim.vim 88.09% <0.00%> (-6.20%) ⬇️
autoload/iced/nrepl/var.vim 81.70% <0.00%> (-5.97%) ⬇️
autoload/iced/nrepl/connect.vim 71.77% <0.00%> (-5.91%) ⬇️
autoload/iced.vim 88.57% <0.00%> (-5.72%) ⬇️
autoload/iced/qf.vim 94.44% <0.00%> (-5.56%) ⬇️
autoload/iced/buffer/stdout.vim 73.91% <0.00%> (-1.70%) ⬇️
... and 20 more

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 9572616...40abf77. 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.

@Futurile Thanks a lot!
Cound you confirm my review comments?

doc/vim-iced.txt Outdated Show resolved Hide resolved
doc/vim-iced.txt Outdated Show resolved Hide resolved
doc/vim-iced.txt Outdated Show resolved Hide resolved
doc/vim-iced.txt Outdated Show resolved Hide resolved
doc/vim-iced.txt Outdated
https://github.com/clojure-emacs/cider-nrepl/issues/447"
[]
(require 'cider.nrepl)
(map resolve (var-get (ns-resolve 'cider.nrepl 'cider-middleware))))
Copy link
Owner

Choose a reason for hiding this comment

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

cider-middleware contains all middlewares provided from cider-nrepl.
https://github.com/clojure-emacs/cider-nrepl/blob/v0.25.4/src/cider/nrepl/middleware.clj#L7

Now track-state middleware may lead vim-iced's hang-up. (c.f. #170)
So, to be safe, we should specify the middleware separately, as in Leiningen's example.

Copy link
Contributor

Choose a reason for hiding this comment

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

Btw, now that clojure-emacs/cider-nrepl#447 is fixed, this resolve step is not necessary.

Copy link
Owner

Choose a reason for hiding this comment

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

Thank you for the information!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@liquidz My poor understanding of Clojure and cider are showing here. I believe you wanted it to specifically load the cider middleware that you have for Leiningen. I have done this - probably in the ugliest way possible.

I removed the resolve step as bbatsov suggested.

doc/vim-iced.txt Outdated
(defn start-nrepl-server! []
(reset!
nrepl-server
(nrepl-server/start-server :port nrepl-port :handler (nrepl-handler))
Copy link
Owner

Choose a reason for hiding this comment

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

Are you missing the definition of nrepl-handler?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@liquidz you were right, I missed it out somehow. Updated the PR.

Futurile and others added 3 commits November 1, 2020 21:21
Extraneous space.

Co-authored-by: Iizuka Masashi <liquidz.uo@gmail.com>
Co-authored-by: Iizuka Masashi <liquidz.uo@gmail.com>
Co-authored-by: Iizuka Masashi <liquidz.uo@gmail.com>
Base automatically changed from master to main January 22, 2021 02:45
Co-authored-by: Iizuka Masashi <liquidz.uo@gmail.com>
@Futurile Futurile requested a review from liquidz January 31, 2021 18:05
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.

@Futurile Thanks!
LGTM

@liquidz liquidz merged commit 5d3c321 into liquidz:main Jan 31, 2021
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.

4 participants