Fork me on GitHub

I'm wondering whether I have inadvertently activated a feature of Cursive, or whether the default has changed. When I hover over a word in the editor pane for more than a couple of seconds, the documentation pane opens, which hides my repl. This is quite irritating. I'm used to hitting ctrl-q to get documentation when I want it. Is there a way to turn the hover-doc-mode off @cfleming? I had a look in settings, but I cannot see anything obvious.


I wonder if it is this? > 0.1.54 (Apr 19) > Notable changes: > ... > Hovering over a symbol shows the evaluation of the symbol in a tooltip. (from I'm not getting a tooltip though


Okay, I think I have worked out how to fix this, but you might want to tweak this a bit @cfleming. I had my doc configured to open as a Tool Window. When I changed back to "open as Popup" (see gif 1) then I can hover to get a doc tooltip, then the menu on that tooltip has an option to uncheck "Show on mouse move" (see gif 2)


To reproduce the irritating world I was living in, ctrl-q once then tick "Show on mouse move" in the tooltip elipsis menu, then ctrl-q twice to open the documentation as a tool window. Now you can open the repl tool window, then hover over things in the editor tab and watch the documentation tool window take over the repl.


Hmm, I see. Unfortunately none of that is actually Cursive, that’s just standard IntelliJ features.


oh well, never mind then. Thanks.


Hi, I've got a bit of a problem with my cursive plugin.. I collapsed the REPL input field and I can't seem to figure how to get it uncollapsed. Any tips?


so annoying when this happens 😅


turns out, you can also just double-click on the divider to reset the height of the editor pane.


oo that’s good to know


I've tried the drag up from the bottom but haven't succeeded in it. Double tap worked out nicely tho, Thanks!


I think that my problem with the draggin might have been the fact that I had the file tabs under the REPL window and that's why the drag up didn't register correctly.


does anyone know how to tell Cursive to package Clojure source files into whatever JAR gets made when you “build” a project? My project uses Maven, and this works fine w/ clojure-maven-plugin when I build on the command line, but when I build via IntelliJ, the application blows up at startup when trying to load Clojure files only from my project (finds e.g. clojure.core just fine) with a message that it can’t find the right .class / .cljc / .clj files


Ive tried telling IntelliJ that this directory is a “resource” directory instead of a “source” directory as well, but that doesn’t seem to help


In my pom.xml, I’m able to achieve this via these clojure-maven-plugin options -



i'm not 100% sure but i don't think cursive works with maven. is there any particular reason you're using maven instead of other clojure-native options?


I don’t have much of a choice - most of the repo is Java, and maven is the build tool the whole org uses


yeah that was my fear… up to now we’ve just been AOT compiling our Clojure code


ok, i see, historical reasons. 🙂


so it feels like this is more of an intellij idea problem.


so if you execute mvn package or something alike it builds the right ubjerjar but if you "build" from within intellij idea it doesn't?


yeah it may be. And yeah, exactly


Cursive has an option to compile (or not / or only some) Clojure namespaces, hence why I started with Cursive


how are you triggering the "building" of the uberjar in intellij idea?


Just Build -> (Re)build Project


I always Rebuild after mucking with compiler settings


have you tried using the Maven tool window?


the Build menu has always been a source of confusion for me. when working with a maven project, i'm not quite certain what it means to execute "Build -> (Re)build Project". is it mvn compile? mvn package? mvn install?


so i would go ahead and try one of those goals in the Maven tool window (whichever you're using on the command line)


hmm that’s a good thought! Let me mess around with that


Right, so compiling within IntelliJ is normally distinct from building with whatever build tool you’re using. The Gradle integration has an option to use the Gradle commands whenever invoking the IntelliJ build, but I don’t know if that’s available for Maven too.


@ When you build your project in IntelliJ, are you sure a jar is produced, or are the artifacts normally built using Maven?


> The Gradle integration has an option to use the Gradle commands whenever invoking the IntelliJ build, but I don’t know if that’s available for Maven too. that just reminded me of an intellij idea feature where you can let intellij idea delegate build actions to maven.


If IntelliJ is actually producing jars for you, it will be done using Artifacts: You can then configure the artifact to include your Clojure source.


@ That was what I meant, thanks for the link.


awesome, I think telling IntelliJ to defer to maven is the way to go here. Unfortunately, maven is definitely slower than IntelliJ 😅


urgh, now of course it doesn’t let me defer only build, so now I have to mess around with the run config because that’s not working properly


@cfleming > You can then configure the artifact to include your Clojure source. Yes, I’ve tried telling IntelliJ that src/clj is a Resource folder, but that doesn’t seem to work


Is there anything that enumerates the ways in which intelliji + cursive does in terms of interopt with java and javascript? and/or compares to popular solutions (e.g emacs + cider) for interopt? I'm quickly approaching the feel that anytime i touch java its worth using intelliji but i would like to be sure of the trade off before the investment.


i've never seen/heard such a thing exists. out-of-the-box, hassle-free, native java inter-op support is one of the important reasons for me to use intellij idea and cursive exclusively for clojure (and any other jvm languages.) i believe cursive relies on (delegates to) the intellij platform when it involves java inter-op and we know the intellij platform has the best support for java therefore i doubt there is, if exists, any other solution that beats what the intellij platform has to offer (for now.)


Would you say cursive gives you everything intelliji can offer when it comes to java when your doing interopt? or are their limitations because your in clojure?


i would say almost everything. in situations where cursive can figure out the type of the thing you’re working with, you get most of those nice things that you get from intellij idea when you’re working with pure java (method signatures, code completion, searching for usages and whatnot)


You want to add type hints to your function parameters, e.g. [^File file]


@ This isn’t explicitly documented anywhere, no, although it should be - it’s on my list to document. Basically Cursive understands Java types (via IntelliJ) and it also performs more or less the same type inference in the editor as the Clojure compiler does. This means that you can get type-sensitive completions in cases like these:


(.meth| ^MyType myObj) Here Cursive knows the type explicitly.


(-> ^MyType myObj .meth|) Same here.


(let [x (MyType.)] (.meth| x)) Here Cursive uses type inference and knows the type of x.


This works for method return types too. Here’s a concrete example:


(let [x (ArrayList.)
      y (.iterator x)]
  (.has| y))


Here Cursive knows the type of x and y, and you’ll get the completions for Iterator (e.g. .hasNext in this case) here.


Note that this works even if Iterator isn’t imported in this namespace.


(In all those examples above, | is where the caret is, and you’ll only get the completions for the relevant type there)


Prefix notation is actually a pain here, since you often type the method before the receiver. Cursive can help with this. If you type (myObj .meth|) and Cursive knows the type of myObj, you’ll get the context sensitive completions there and when you choose the completion the forms will be swapped, and you’ll end up with: (.method myObj |).


It’s been pointed out to me that it would make more sense to use the . form for this: (. myObj meth|) and then on completion convert to the same form above, but that doesn’t work right now.


As well as this, the Java stuff is just nicely integrated - getting doc on an interop form shows the right doc with no setup, navigation to Java source etc, you can rename things in Java and the corresponding Clojure gets updated and vice versa - that all just works. The fancier Java refactorings don’t work automatically for the interop code, e.g. remove parameter etc.


Let me know if you have more questions about this.


Oh, and you also asked about JavaScript - there’s no type inference for JS yet, and it’s much harder than in Java anyway. Cursive has some decent support for the Google Closure library (which should get better soon) but it’s still very primitive compared to the Java interop support.


thanks @cfleming this was very helpful


> This isn’t explicitly documented anywhere, no, although it should be - it’s on my list to document. this would be really helpful in showcasing cursive’s java inter-op features to attract developers who are familiar with intellij idea. i converted a few clojure developers from vscode to intellij idea just by showing how seamless its integration with intellij idea is and how you can leverage almost all of your intellij idea knowledge when writing clojure code. of course, i did it manually so it’s totally possible i missed some. it would be great if i could just point them at some kind of animated demos (like the paredit/parinfer gifs.) on the cursive site.


BTW one other major thing I forgot to mention here is debugging - since it’s all JVM, you can debug from Clojure through Java and back again, which is a lot of peoples’ main motivation for using Cursive I believe.


And in all the above, you can substitute Scala/Kotlin/whatever for Java as needed.