holy hara i just found the macroexpand shortcut and I’m 😹
oh, this seems to be working again
First time I had success with it in months
That’s odd, I wonder if it’s something in IntelliJ that has changed - certainly the Cursive part of that hasn’t changed in ages.
Not sure. I couldn't get the window to appear until today. It still opens on another monitor, not the on my intellij is on and I can't seem to be able to move it
yeah this is going to be really awesome for me. I am noticing that in some cases, this is all that shows up. some kind of plugin issue?
That looks like a bug, yeah. What are you trying to expand?
in this particular case, https://github.com/metabase/metabase/blob/master/src/metabase/models/collection/root.clj#L17
which is: https://cljdoc.org/d/potemkin/potemkin/0.4.5/api/potemkin.types#defrecord+
Thanks, I’ll try to reproduce that.
I’m wondering if there’s any way to copy that buffer to the clipboard
I'm finding that I'm unable to interact with the macroexpansion popup in any way actually
but at least it now appears
What's the current recommended way to run CLJS REPL using Cursive? Tubular client?
I was not aware of vlaaad's remote-repl. thx!
mind elaborating on this?
There’s no one good answer to this, it depends on what your CLJS process is doing. But I think the closest I can come to a good universal answer is “use shadow”. Shadow always uses nREPL which makes your CLJS REPL behave almost completely like a CLJ one.
If you do want a tubular-like thing, https://github.com/vlaaad/remote-repl seems to be a better option.
Does normal C+P not work?
I really need to document that thing.
@jeffrey.wayne.evans Tools | REPL | View macroexpansion… will give you a popup interactive macroexpander for the macro form under the caret.
I’ve been working on it a bit recently, some people have had problems with the popup, so YMMV until I get that fixed.
🤯
like, cmd+p?
This buffer is more like an autocomplete buffer
I’m unable to focus it at all.
It could be that I’m also using ideavim(?)
Sorry, no, I meant normal cut + paste. I’ll try that to see if it works.
@cfleming I have a feature request: Is it possible to have send form ... to REPL
to work a bit more seamlessly with multiple REPLs? It would be nice to have two sets of send form
, one will just send it to whatever REPL is currently active/selected, and another set will display a popup asking for which REPL to send the form to, and will switch automatically to that REPL so I can see the evaluation.
I think I found out how automatic require/autocomplete works... you need to write one manual (:require [library :as shorthand])
in one of your files and after you did that, you can then use shorthand
(and only that) for autocomplete/autorequire. I would've hoped it worked more like normal intellij where it simply indexes everything... that sucks
Yeah, gotta remember that Clojure's notion of symbols makes that more difficult than Java where there IntelliJ can know something is a class/interface just due to naming convention.
I see that the release of IJ 2020.3.3 is finally out and I’d like to upgrade to it but I’ve slowed my upgrade cadence since becoming a FT clojure dev. I used to run EAPs of IJ but that’s now too much underlying change since I depend on Cursive + IJ to work in concert. I assume that 2020.3.3 is a safe upgrade?
I upgraded sometime in the past 48 hours and found no issues so far
and macroexpansion started working again after months but I'm unsure whether that was due to the upgrade
👍
Hi all. Is there an option within IntelliJ or cursive to use a specific alias when editing code within a deps.edn project? I can obviously run a REPL with any alias, but I have a few aliases which add external libraries and so I get warnings about ‘class cannot be resolved’ when I know at runtime it will be resolved by some extra dependencies in the alias definition. Am I missing something in the project set-up page? I have found some global settings (my project settings pane appears empty) but putting things in there doesn’t seem to have an effect.
We're experimenting with converting from project.clj to deps.edn in our very, very large, multi-module project. So far, I haven't managed to get it to work at all; using "New project from existing sources" and then choosing the root folder of my multi-project, Cursive finds no deps to import. Does there need to be a top-level deps.edn file for this to work? What would that look like exactly? IDEA 2020.3, Cursive 1.10.1-2020.3.
Update: Downloading a fresh copy of my project from Git, into an entirely new folder, worked. Cursive may be storing some project-specific data outside of the project itself -- I had tried deleting the .idea directory of my existing project.
Then I found out I can't re-create my original project.
Now I'm into ~/Library/Caches/JetBrains/IdeaIC2020.3 looking for things to delete.
Ok, got my original project working again with Leiningen after finding and deleting all .iml files in my workspace.
I think the best way to try this out would be to migrate module by module. So I’d pick a leaf module from your tree, un-register it with Leiningen and then File | New… | Module from existing sources and add the deps.edn.
Jeez! Sorry to spam this! I thought I had started a fresh thread. It's been that kind of day.
It’s only a minor issue; the simplest fix is to just temporarily alter my deps.edn to include the needed dependencies in the main list while developing that module.
You can do this, see here: https://cursive-ide.com/userguide/deps.html#working-with-aliases
My apologies, I meant to reply to your message the other day and somehow dropped it. Yes, currently Cursive relies on having an example, this is because it needs to know which alias you’d like to use for a particular namespace. Cursive does index everything, but it seemed dangerous to automatically assume that e.g. the last segment of the namespace should be used as an alias.
I don’t know if this is a jetbrains thing or cursive specific thing but I figured I’d ask. I would love to use multiline editing to select these lines, then hold shift and hit alt->right arrow to select the entire first expression, but expressions with hyphens get split.
is there a way to say hyphen’s don’t split words?
i noticed that double click on a word with a hyphen selects the whole thing
i dunno maybe i don’t want to do that.. does anyone have a preference either way?
I'd try expand selection
@cschep ^
@cfleming maybe I'm missing something, but why can't it work (almost) exactly like it does in standard intellij? Have a look at https://www.jetbrains.com/help/idea/auto-completing-code.html#invoke-basic-completion, or short summary follows: press ctrl+space once, get suggestions for all directly accessible vars/methods. Hit ctrl+space twice, it shows inaccessible but importable vars/methods. Hit ctrl+space thrice, it suggests everything.
Currently, in cursive, only the first completion works out-of-the-box. No automatic require necessary because it is already required.
The second completion is currently packaged within the first completion, and only happens when you already have an example.
But it could work like this:
1. Premise: Let's say I don't have an example :require
already but I want to use`integrant.core/init-key` (which is added as library to my project but never used yet)
2. I enter init-k
and press ctrl+space once. Nothing appears.
3. I press ctrl+space a second time. It shows integrant.core/init-key
in the completion list (like this: https://i.imgur.com/KVbrvg1.png)
4. I press enter. It automatically :require
s integrant.core
(no :as
) and replaces my typed init-k
with integrant.core/init-key
(like this: https://i.imgur.com/kgrE8hC.png)
Second use-case, same premise:
1. I type ig/init-k
and press Ctrl+Space. Nothing appears.
2. I press Ctrl+Space again. integrant.core/init-key
is suggested (like this: https://i.imgur.com/BQrU41L.png)
3. I press enter. ig/
is not equal to integrant.core/
, so I want an alias for integrant.core
called ig
It adds a :require [integrant.core :as ig]
and replaces ig/init-k
with ig/init-key
(like this: https://i.imgur.com/ItvGpYS.png)
All seems very simple and straight-forward to me, and I'd hope that you could reuse everything from the way the java completion works. Would only need to add the ig/
handling while expanding.
i’m not familiar with that
any insight?
It appears so on the mac
awesome, thanks!
that doesn't look like valid clojure to me, is there something wrapping all this? it could be that it doesn't understand that these are identifiers and thus does not select the whole thing
Or abstractly speaking: I don't really see why it matters to have an example or not - just let the user write anything before the /
, and use whatever was written before the /
as the :as
and the namespace of whatever was selected in the list as the namespace to :require
The third usecase would be a duplicate :as
, but which could also be easily handled. Let's say I already have :require [integrant.core :as ig]
. When I now type in/init-key
and select integrant.core/init-key
from the completion list, it changes my in/init-key
to ig/init-key
and leaves the existing :require
untouched
I think this would be really valuable for Cursive, for any new project this would save a lot of time (it would've saved me a lot of time already) - and as a user coming from java I'm incredibly annoyed by it not working like it does with java
Brilliant. Thank you. Assumed I was missing something. Many thanks.
sorry, it's extend selection
, an intellij default command
works extremely well in clojure
think it’s alt-up / down by default?
Thanks for the detail, I like the idea of defaulting the alias based on the use at the completion point. I’ll look at implementing that.
I’ve been meaning to do the same for static method invocations, if I type MyClass/met|
, currently that doesn’t work in Cursive if MyClass
is not imported yet.