Repository navigation
Fix lookups in ClojureScript, bare namespaces and Java - #28
Merged
Merged
Conversation
The fallbacks that evaluate code, for servers without cider-nrepl or nREPL's lookup, and source always, ran in the namespace looked in, using require and symbol unqualified, so they failed in a namespace that doesn't refer clojure.core, like one in-ns made. They now compile in user, after requiring what they need in a top-level form of its own, with *ns* bound to the namespace looked in.
cider-nrepl's info for a Java member has no name, but a class and a member, so doc said there was nothing called Thread/sleep, and the REPL showed no arglists for (.toUpperCase, while a class's doc was raw Javadoc. The member's class now stands for its namespace and the class for a class's name, and the doc comes from cider-nrepl's Javadoc fragments, as text. A field's arglists, which come as nil, are left out, and a namespace's info, which names it twice, loses its :ns, so it's named once.
clojure.repl/source-fn only reads files on the classpath, so source found nothing after neorepl load of a file from anywhere else, which breaks the skill's load then look up, nor anything in ClojureScript. source now reads the definition from the file and line info gives, as CIDER does, as far as the form goes, and falls back to source-fn for a file this machine can't read. It takes the form only if it's a definition, since cider-nrepl gives the macros ClojureScript takes from Clojure lines from somewhere else.
cider-nrepl's macroexpand evaluates in the session it's given, so ,macroexpand left its expansion as the REPL's *1. It now goes to a copy of the session, which keeps its language.
The CLI's lookups looked in user, or --ns, and outside any session, so they couldn't reach a session's ClojureScript, nor the namespace it's in, and neither could the MCP tools. --session NAME, and the tools' session, which is agent by default there, now send the lookups to that session, in its namespace unless --ns says otherwise. In ClojureScript that's the Clojure namespace under it, which is all describe has.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
sourcenow reads definitions from the file and lineinfogives, the way CIDER does, which is what makes it work afterneorepl loadand in ClojureScript. The other commits fix lookups that failed in namespaces made byin-ns, Java members and classes that came back as nothing or as raw Javadoc, and,macroexpandreplacing*1.--sessionfor the lookups is the one new feature. In a ClojureScript session it only knows the Clojure namespace underneath, because that's alldescribereports, so--nsnames the ClojureScript one until piggieback reports it.