Comments (16)
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.
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.
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.
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.
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.
Would be great to see this as a branch on your fork or as a pull request once it's ready.
from cider.
@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.
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.
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.
@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.
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.
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.
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.
Pull request #43 provides a mechanism for making synchronous requests to the backend.
from cider.
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.
This is merged now. Thanks @ska2342.
from cider.
Related Issues (20)
- Timbre logs can show in the minibuffer HOT 18
- configure cider to use PowerShell 7.x and not Windows PowerShell 5.1 on windows HOT 23
- Logback logs not showing in `*cider-log*` buffer HOT 5
- CIDER does not work with Java 21 HOT 1
- Invalid face box when starting in debug mode HOT 1
- `[shadow-cljs]` output lost when repl-ing node http server HOT 2
- I have developed a simple way to search Clojure symbols with CIDER; merge into this package or keep separate? HOT 6
- Customize banner HOT 8
- Can't cider-jack-in to projects with private git dependencies HOT 7
- `cider--error-phase-of-last-exception` can call itself when the cider-nrepl middleware is faulty HOT 3
- Lots of compilation warnings since update to Emacs 29 HOT 4
- `cider-inspector-inspect-last-exception` should inspect specific exceptions, not the last one HOT 3
- `cider-test-run-loaded-tests` not running newly loaded tests after changing REPL namespace HOT 1
- cider-log: multiline items HOT 5
- Auto completion is not reliable after switching to cider-nrepl 0.45.0 HOT 4
- i'm unable to access javadocs HOT 2
- Don't offer to connect to YourKit ports
- cider-ns: jump to file/line on errors
- cider-ns-refresh: summarize errors as an overlay
- Wrong type argument: plistp HOT 13
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cider.