Fork me on GitHub
#cider
<
2015-12-27
>
crocket07:12:53

auto-completion is broken in cider after moving to a new namepsace on a CLJS REPL.

bozhidar08:12:49

if you encounter issues - it’s best to report them on github

bozhidar08:12:06

ideally, with some repro steps

crocket08:12:36

@bozhidar: I already reported an issue on github. Check it out

Michael Griffiths13:12:00

Do you get a stacktrace dumped to the REPL?

Michael Griffiths14:12:57

Thanks, that's enough for me to replicate - I'll take a look this evening simple_smile

Michael Griffiths14:12:33

I think the first two examples are expected; cljs.repl is only automatically required in the cljs.user namespace

crocket14:12:10

So, what is wrong?

Michael Griffiths14:12:36

But the latter sounds like either a bug in the CLJS autocompletion code, or possibly a bug in the CLJS compiler itself (can you successfully use any of the macros in cljs.repl that you didn't specifically impot?)

Michael Griffiths14:12:21

Oh, I see, you're still seeing print-doc in the completions for the first two cases

crocket14:12:29

@cichli: I can execute (cljs.repl/source cljs.repl/doc) after executing (ns hello-world.test (:use-macros [cljs.repl :only [doc]])).

crocket14:12:59

Macros are only not available for auto-completion, but they are always there.

crocket14:12:34

Even after (ns something.core), cljs.repl/doc, cljs.repl/source, etc are available for invocation. But, they are not available for auto-completion.

Michael Griffiths14:12:50

This issue might be specific to cljs.repl, so we might just have to special-case that. I'll see if the issue occurs for other macro namespaces

Michael Griffiths14:12:01

Thanks for the detailed report simple_smile

crocket14:12:03

I haven't tested other namespaces, yet. I think making it a special-case would be fragile since clojurescript can change later.

Michael Griffiths14:12:52

If everything in cljs.repl is always available in all namespaces in CLJS REPLs, that's not too likely to change - it's hard not to special-case as we rely on data from the CLJS compiler to populate the completions, which doesn't have any knowledge of REPL-specific quirks like that namespace always being available

Michael Griffiths14:12:48

I wouldn't actually hardcode everything that's in cljs.repl into the completions - I'd still introspect that NS and get all the public vars + macros

crocket14:12:00

cljs.core doesn't hide anything.

crocket14:12:00

Ouch, cljs.pprint is unavailable for auto-completion after moving to a new namespace. What is this?

crocket14:12:11

Why do namespaces hide completely or expose themselves partially after moving to a new namespace?

crocket14:12:15

At this point, I surmise clojurescript exposes only required namespaces reliably.

crocket14:12:34

cljs.core is always available for invocation and auto-completion

crocket14:12:15

cljs.repl/print-doc is always available for auto-completion, and the rest of cljs.repl is available for only invocation when it's not required.

crocket14:12:30

@cichli: If I launch figwheel on lein repl, cljs.repl is somehow available for auto-completion after invoking (ns).

crocket14:12:14

Somehow, figwheel on lein repl fails to auto-complete my namespaces.

crocket14:12:34

The auto-completion is like a roller coaster for now.

Michael Griffiths14:12:24

Completion is contextual depending on the namespace because the following is not a valid ClojureScript program:

(ns foo)

(cljs.pprint/pprint "bar")
You can't use any namespaces that you haven't explicitly required (except cljs.core obviously). We haven't done the work to make CIDER's completion be smart enough to differentiate between "completing in a code file" and "completing at the REPL", so the completions you get are as if you're editing the file for that namespace, and the only completions we show are those that would be valid to include in the file.

Michael Griffiths14:12:48

> The auto-completion is like a roller coaster for now. What's that supposed to mean?

crocket14:12:07

I couldn't have been able to predict what would be available for auto-completion so far. So, my mood fluctuated like a roller coaster.