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

Implement cider-nrepl info #30

Closed
PEZ opened this issue Oct 11, 2020 · 3 comments
Closed

Implement cider-nrepl info #30

PEZ opened this issue Oct 11, 2020 · 3 comments

Comments

@PEZ
Copy link

PEZ commented Oct 11, 2020

Calva relies heavily on the info op. It's how it looks up docs and implements peek at definition and jump to definition, and generally provides info about symbols.

Here's the cider-nrepl implementation: https://github.com/clojure-emacs/cider-nrepl/blob/master/src/cider/nrepl/middleware/info.clj

Not sure where to find documentation on this op...

@borkdude
Copy link
Contributor

Can you post some example of input + output? I have no idea what to implement without any docs.

@PEZ
Copy link
Author

PEZ commented Oct 11, 2020

Yeah, I've reverse engineered this myself when implementing this. 😄

This is what Calva sends when I ask for info on re-matches:

{
    "op": "info",
    "ns": "ring-server.core",
    "symbol": "re-matches",
    "id": "1290",
    "session": "03a1fd4b-3ebc-42d7-a073-3bb5df0e858c"
}

This is what I get back:

{
    "added": "1.0",
    "arglists-str": "[re s]",
    "column": 1,
    "doc": "Returns the match, if any, of string to pattern, using\n  java.util.regex.Matcher.matches().  Uses re-groups to return the\n  groups.",
    "file": "jar:file:/Users/pez/.m2/repository/org/clojure/clojure/1.10.0/clojure-1.10.0.jar!/clojure/core.clj",
    "id": "1286",
    "line": 4886,
    "name": "re-matches",
    "ns": "clojure.core",
    "resource": "clojure/core.clj",
    "see-also": [
        "clojure.core/re-find",
        "clojure.core/subs",
        "clojure.core/re-groups",
        "clojure.core/re-pattern"
    ],
    "session": "03a1fd4b-3ebc-42d7-a073-3bb5df0e858c",
    "static": "true",
    "status": [
        "done"
    ]
}

Please let me know if I can provide some more/better info on this.

@PEZ
Copy link
Author

PEZ commented Oct 11, 2020

Here's another example.

Evaluating this form:

(defprotocol P
  (foo [x])
  (bar-me [x] [x y]))

And then asking Calva to get me info about bar-me, this is what is sent and received back:

{
    "op": "info",
    "ns": "ring-server.core",
    "symbol": "bar-me",
    "id": "1296",
    "session": "03a1fd4b-3ebc-42d7-a073-3bb5df0e858c"
}

{
    "arglists-str": "[x]\n[x y]",
    "file": "file:/Users/pez/Projects/tests/ring-server/src/ring_server/core.clj",
    "id": "1297",
    "line": 13,
    "name": "bar-me",
    "ns": "ring-server.core",
    "protocol": "#'ring-server.core/P",
    "session": "03a1fd4b-3ebc-42d7-a073-3bb5df0e858c",
    "status": [
        "done"
    ]
}

brdloush added a commit to brdloush/babashka.nrepl that referenced this issue Mar 28, 2021
Adds handling of :lookup and :info operations, so that IDEs can offer
function parameters and documentation strings of functions.
borkdude pushed a commit that referenced this issue Mar 28, 2021
Adds handling of :lookup and :info operations, so that IDEs can offer
function parameters and documentation strings of functions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants