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

incorrect namespace being sent for "info" nrepl resolution of aliased symbols in completion handler #1083

Closed
brdloush opened this issue Mar 29, 2021 · 0 comments
Labels
bug Something isn't working repl

Comments

@brdloush
Copy link
Contributor

(Creating issue for this as @PEZ asked on slack channel #babashka-sci-dev)

With following code..

(ns foo)
(require '[clojure.string :as str])
(str/)

.. and cursor positioned just after the / in str/, calva sends incorrect namespaces in :info messages sent to cider-nrepl server when doing code completion via ctrl+space. Instead of passing foo as :ns in the message, it's actually passing clojure.string. This is what server receives when navigating between the offered code-completed functions:

msg: {:op :info, :ns clojure.string, :symbol str/, :id 34, :session 353803b8-23fd-4383-aa5b-1fb7879dd0c4}
msg: {:op :info, :ns clojure.string, :symbol str/blank?, :id 37, :session 353803b8-23fd-4383-aa5b-1fb7879dd0c4}
msg: {:op :info, :ns clojure.string, :symbol str/capitalize, :id 40, :session 353803b8-23fd-4383-aa5b-1fb7879dd0c4}

Instead of "clojure.string", "foo" should be sent in this case.

According to slack conversation in https://clojurians.slack.com/archives/G01J18EUH6H/p1617016471044200,

pez:calva: 1:14 PM
Hmmm, seems we’re on to something. Calva sends info (correctly) on hover. But also this one with a funny ns when I hit ctrl+space.

pez:calva: 1:22 PM
Yes, wrong ns, even though that has so far not mattered b/c I think that the “regular” nrepl server figures that out, like it also doesn’t actually need the ns. It was added recently because babashka wanted it.
I’ll fix it.

pez:calva: 1:34 PM
The ns thing is just a bug that has gone unnoticed until now.
At least I think so. It looks very deliberate when i look at the code. 😃

FYI The plain emacs + cider + company-mode sends message in following format to nrepl server when fetching information about function params on code-completion. (they're actually using "eldoc" but using "info" or "lookup" should be fine (they just have a bit different keys in the response):

msg {:op :eldoc, :ns foo, :sym str/includes?, :session 4d8840fd-31e9-46a4-9a89-637251afcef9, :id 133}
reply: {ns clojure.string, name includes?, eldoc [[s substr]], type function, status #{done}, docstring True if s includes substr.}

msg {:op :eldoc, :ns foo, :sym str/index-of, :session 4d8840fd-31e9-46a4-9a89-637251afcef9, :id 134}
reply: {ns clojure.string, name index-of, eldoc [[s value] [s value from-index]], type function, status #{done}, docstring Return index of value (string or char) in s, optionally searching
  forward from from-index. Return nil if value not found.}
@brdloush brdloush changed the title calva sends incorrect namespaces for aliased calva sends incorrect namespaces for "info" nrepl resolution of aliased symbols' Mar 29, 2021
@brdloush brdloush changed the title calva sends incorrect namespaces for "info" nrepl resolution of aliased symbols' calva sends incorrect namespaces for "info" nrepl resolution of aliased symbols Mar 29, 2021
@brdloush brdloush changed the title calva sends incorrect namespaces for "info" nrepl resolution of aliased symbols incorrect namespace being sent for "info" nrepl resolution of aliased symbols Mar 29, 2021
@PEZ PEZ added bug Something isn't working repl labels Mar 29, 2021
@PEZ PEZ changed the title incorrect namespace being sent for "info" nrepl resolution of aliased symbols incorrect namespace being sent for "info" nrepl resolution of aliased symbols in completion handler Mar 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working repl
Projects
None yet
Development

No branches or pull requests

2 participants