Fork me on GitHub
#cursive
<
2017-12-08
>
echristopherson02:12:39

oh, that's a parameter -- that must be what (p) means

echristopherson02:12:32

OK, here's something else: I am in the debugger and I clicked on a stack frame that's in Java with no source (part of Clojure)

echristopherson02:12:14

but the place in the decompiled source isn't the right place

cfleming02:12:34

@echristopherson Hmm, that’s an IntelliJ issue I think.

cfleming02:12:44

But you should be prompted to download the source?

echristopherson02:12:16

I seem to remember being prompted to download source, but I don't remember if it was for Java or for Clojure. But either way, I always get decompiled classes

cfleming02:12:17

Click the Download… link in the banner at the top of the editor.

echristopherson02:12:45

oh, that just downloads one source file?

cfleming02:12:50

I think that is the correct definition of invoke, in RestFn

cfleming02:12:05

No, it downloads the source for that lib and attaches it.

echristopherson02:12:19

I see that when I download the source, it shows the right source file, but it doesn't jump to line 397

cfleming02:12:41

If you click on the stack frame element again, does it navigate correctly?

echristopherson02:12:43

Oh, OK. Java source does show up too.

cfleming02:12:57

That’s very weird.

cfleming02:12:19

Unfortunately it’s out of Cursive’s scope, that’s the underlying JVM debugger, but it seems odd.

echristopherson02:12:08

I can't remember what the command is called that gives you a popup menu of things you can do with the current file -- like opening it in the navigator or the OS file manager

cfleming02:12:46

Select In….

cfleming02:12:57

Alt-F1, at least on a Mac

echristopherson02:12:23

This seems like a nice IDE platform

cfleming02:12:32

Thanks, I’m glad you like it!

cfleming02:12:46

The IntelliJ platform is really nice to build on.

echristopherson02:12:51

Here's something I've wondered about IDEs with certain languages: when you put the function name before all the parameters -- instead of putting the receiver parameter before the function name as in Java -- how is completion implemented? Like, can you invoke a function completion without having already typed a function name, but somehow specify that you want to see all the functions that take a string as first param?

echristopherson02:12:57

Oh wow. I see you have a fork of a project called riddley -- which is named after a book I like, that I was just reading about yesterday.

cfleming02:12:22

Right, it’s a code walker 🙂

cfleming02:12:39

ztellman is a literary sort of chap.

cfleming02:12:00

Re: completion, it’s tricky. Generally for vars it’s fairly easy since the available ones don’t depend on the first argument.

cfleming02:12:11

It’s a problem with interop, though.

cfleming02:12:49

Cursive handles this by doing type inference, and allowing you to do (my-obj .myMet<complete>)

echristopherson02:12:04

Oh, for Java objects

echristopherson02:12:13

I was just thinking that

cfleming02:12:37

That will then autocomplete to (.myMethod my-obj|), only offering methods available for the type of my-obj if Cursive can figure it out.

cfleming02:12:51

Otherwise if you just autocomplete (.myMeth<complete>) then Cursive will offer all methods available on all imported classes, plus methods available in the types of any local variables that are in scope that it can figure out.

echristopherson02:12:50

so... (my Clojure's kind of rusty...) (my-obj .myMethod) doesn't actually work in Clojure? It has to be transformed by the IDE?

cfleming02:12:59

So in a case like:

(let [list (ArrayList.)
      iterator (.iterator list)
  (.ne<complete>))

cfleming02:12:29

Cursive will offer .next as a completion even though Iterator isn’t imported.

echristopherson02:12:39

oh! right, I am rusty... I was forgetting about the dynamic typing

cfleming02:12:00

Right, interop takes the method first, then the receiver.

echristopherson02:12:34

Hmm, I have .next as the fifth item

cfleming02:12:59

That’s possible, yes - it can’t know which one you’d like of the available options.

echristopherson03:12:41

Oh, OK. I thought you were saying it would put the Iterator one at the type via inference.

cfleming03:12:56

No, but it uses type inference to even know that .next should be in the list.

echristopherson03:12:16

I'm having trouble triggering it to move .myMethod to the front

cfleming03:12:15

What are you trying to do?

echristopherson03:12:33

just trigger a completion from (the-list .iter|) to (.iterator the-list)

cfleming03:12:13

So, one thing is that right now this will only happen in a standard code editor, and not the REPL editor.

echristopherson03:12:28

Right. I tried in both places, figuring that might be true.

echristopherson03:12:02

Since I'm not in a REPL now, maybe I need to use a let as you did, otherwise the code sense thing doesn't know the-list is an ArrayList?

cfleming03:12:59

How did you define the-list?

echristopherson03:12:18

I just tried letting it and it worked there.

echristopherson03:12:45

You might want to make (. the-list iter|) complete also.

cfleming03:12:53

Yes, def doesn’t add type information to the var it defines unless you explicitly hint it.

cfleming03:12:19

Yeah, I’m planning to do that, since it’s also consistent with the built-in form that interop desugars to.