Git Product home page Git Product logo

Comments (16)

ska2342 avatar ska2342 commented on May 17, 2024

Does it require a function in the nrepl backend, similar to how completions are retrieved? That seems cleaner to me than to pass some fn over the wire.

(Please excuse, if I am asking stupid questions. Just began reading the code.)

from cider.

technomancy avatar technomancy commented on May 17, 2024

I think this could be done in a line or two, so it would probably look more like the M-. support than the completion support.

from cider.

ska2342 avatar ska2342 commented on May 17, 2024

Hm,

took a look at this. AFAIU all communication with the nrepl backend is done asynchronously by creating an appropriate handler function and nrepl-send-string seems to always return nil (not very sure on this). OTOH eldoc expects the buffer local function to return the documentation to display.

I am probably missing something here (or just didn't spend enough time staring at the code yet).

from cider.

technomancy avatar technomancy commented on May 17, 2024

I suspect you'd have to send off an async call and then poll for the response unfortunately since we don't have continuations in elisp. =(

from cider.

ska2342 avatar ska2342 commented on May 17, 2024

I think i figured it out. At least I now have some basic eldoc documentation in place. Its probably not very robust (the creation of the clojure code uses format and nrepl-symbol-at-point but does not escape any bad things in the symbol so the form might break). The retrieval of the documentation is not as sophisticated as the version found in swank-clojure or in clojure.repl.doc but it seems to work.

If you are interested I can provide the code either as an attachment or via github. Shall I create a branch on my fork for this or how would you like to see it (if at all)

from cider.

technomancy avatar technomancy commented on May 17, 2024

Would be great to see this as a branch on your fork or as a pull request once it's ready.

from cider.

kingtim avatar kingtim commented on May 17, 2024

@ska2342 thought you might find this useful. I have version of this that I was working on porting over from swank-clojure which does not use eldoc.
You can check it out on my arglist branch that I just pushed.
Feel free to steal from it or whatever. I am not familar enough with eldoc to know what advantages it would provide over this approach, but this seems to work.

from cider.

ska2342 avatar ska2342 commented on May 17, 2024

Cool. Depending on when my son will sleep, I might find the time today to merge your stuff.

Advantage of eldoc is, that it provides the (tiny) framework. No need to fiddle with timers ourselves. There is also some support for highlighting parts of the doc, but I didn't look at it yet.

from cider.

kingtim avatar kingtim commented on May 17, 2024

How would you feel about me merging this into master, and then when you are able to get eldoc stuff working, we can replace this with that?

from cider.

ska2342 avatar ska2342 commented on May 17, 2024

@kingtim Merged your function to get the operator before point with my stuff.

I use a simpler Clojure function, but as far as I can tell, the only difference will be, that my code does not give "[map]" as an arglist for keywords as operators. Can't tell, whether that's worth the trouble.

Note however, that this code also throws an NPE when the ns was not yet loaded.

You can find it in the eldoc branch of my fork.

from cider.

kingtim avatar kingtim commented on May 17, 2024

Cool. Looks good. Here is my feedback based on a few minutes of testing:

  • I had to manually turn-on-eldoc-mode in my clojure buffer to get it to work. Do we want to turn that on automatically?
  • Also, I think we would want to wire the same thing into the repl buffer as well.
  • The version on my branch seems to work okay even before the ns has been loaded, not sure what the difference is.

Thanks!

from cider.

technomancy avatar technomancy commented on May 17, 2024

The traditional thing is to have eldoc be an opt-in feature that people enable via hooks. But I don't really see why we need to do this; turning on eldoc by default seems completely reasonable to me.

from cider.

ska2342 avatar ska2342 commented on May 17, 2024

ElDoc is now enabled in nrepl-mode and clojure-nrepl-mode. Function name is highlighted in appropriate font lock face.

I don't think I'll be able to work on this in the next days (new job, new city...), though.

from cider.

purcell avatar purcell commented on May 17, 2024

Pull request #43 provides a mechanism for making synchronous requests to the backend.

from cider.

kingtim avatar kingtim commented on May 17, 2024

This seemed to work fine async.
If you can submit a pull request I can get what you have merged in to master.

from cider.

kingtim avatar kingtim commented on May 17, 2024

This is merged now. Thanks @ska2342.

from cider.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.