This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-07-07
Channels
- # babashka (7)
- # beginners (218)
- # boot (1)
- # chlorine-clover (2)
- # cider (36)
- # cljsrn (8)
- # clojure (71)
- # clojure-dev (9)
- # clojure-europe (11)
- # clojure-france (1)
- # clojure-italy (5)
- # clojure-nl (5)
- # clojure-uk (24)
- # clojurescript (9)
- # conjure (16)
- # cursive (65)
- # datomic (76)
- # devcards (21)
- # emacs (1)
- # etaoin (1)
- # figwheel-main (47)
- # fulcro (37)
- # hyperfiddle (9)
- # java (2)
- # kaocha (1)
- # malli (11)
- # music (14)
- # observability (8)
- # off-topic (32)
- # re-frame (13)
- # reagent (2)
- # reitit (5)
- # ring (3)
- # shadow-cljs (40)
- # slack-help (17)
- # spacemacs (15)
- # tools-deps (5)
- # xtdb (16)
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 https://cursive-ide.com/eap.html) 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.
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 -
<temporaryOutputDirectory>true</temporaryOutputDirectory>
<copiedNamespaces>
<namespace>project.*</namespace>
</copiedNamespaces>
<copyDeclaredNamespaceOnly>true</copyDeclaredNamespaceOnly>
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
indeed
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
Just Build -> (Re)build Project
I always Rebuild after mucking with compiler settings
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.
@U8XCX0732 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. https://www.jetbrains.com/help/idea/delegate-build-and-run-actions-to-maven.html#delegate_to_maven
If IntelliJ is actually producing jars for you, it will be done using Artifacts: https://www.jetbrains.com/help/idea/working-with-artifacts.html. You can then configure the artifact to include your Clojure source.
@UDCGPTV9R 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]
@U0DJ4T5U1 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:
(let [x (MyType.)] (.meth| x))
Here Cursive uses type inference and knows the type of x.
Here Cursive knows the type of x and y, and youâll get the completions for Iterator
(e.g. .hasNext
in this case) here.
(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.
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.
> 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.