Fork me on GitHub
#cursive
<
2021-03-17
>
potetm00:03:02

holy hara i just found the macroexpand shortcut and I’m 😹

Jeff Evans01:03:19

mind elaborating on this?

cfleming02:03:23

I really need to document that thing.

cfleming02:03:35

@U0183EZCD0D Tools | REPL | View macroexpansion… will give you a popup interactive macroexpander for the macro form under the caret.

💯 9
cfleming02:03:15

I’ve been working on it a bit recently, some people have had problems with the popup, so YMMV until I get that fixed.

imre08:03:56

oh, this seems to be working again

imre08:03:07

First time I had success with it in months

cfleming09:03:51

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.

imre12:03:50

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

Jeff Evans15:03:25

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?

cfleming19:03:32

That looks like a bug, yeah. What are you trying to expand?

cfleming20:03:06

Thanks, I’ll try to reproduce that.

thanks2 3
potetm00:03:22

I’m wondering if there’s any way to copy that buffer to the clipboard

cfleming01:03:39

Does normal C+P not work?

potetm02:03:12

like, cmd+p?

potetm02:03:31

This buffer is more like an autocomplete buffer

potetm02:03:40

I’m unable to focus it at all.

potetm02:03:50

It could be that I’m also using ideavim(?)

cfleming03:03:23

Sorry, no, I meant normal cut + paste. I’ll try that to see if it works.

imre16:03:34

I'm finding that I'm unable to interact with the macroexpansion popup in any way actually

imre16:03:41

but at least it now appears

onetom01:03:49

What's the current recommended way to run CLJS REPL using Cursive? Tubular client?

cfleming01:03:48

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.

👍 3
cfleming01:03:12

If you do want a tubular-like thing, https://github.com/vlaaad/remote-repl seems to be a better option.

onetom11:03:50

I was not aware of vlaaad's remote-repl. thx!

aratare09:03:17

@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.

Azzurite15:03:56

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

cfleming20:03:03

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.

Azzurite21:03:30

@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 :requires 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.

Azzurite21:03:24

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

Azzurite21:03:09

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

Azzurite21:03:16

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

cfleming22:03:50

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.

cfleming22:03:13

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.

Azzurite00:03:36

cool! I'm looking forward to it! the standard intellij autocomplete is so amazing and I really hope you can get that working. Like even in your example, what I usually do in java isn't to write MyClass/met| but I write something like MyC/| and MyClass/met| will be one of the first results

Azzurite00:03:47

if you save 80% of characters while typing it really boosts your productivity

😁 3
cfleming01:03:35

Right, unfortunately that won’t work for Clojure if I’m relying on the name of the symbol qualifier to get the new alias name.

mikejcusack17:03:33

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.

Jeffrey Bay17:09:58

I added a related issue that I think is even simpler: https://github.com/cursive-ide/cursive/issues/2728

R.A. Porter15:03:12

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?

imre15:03:09

I upgraded sometime in the past 48 hours and found no issues so far

3
imre15:03:57

and macroexpansion started working again after months but I'm unsure whether that was due to the upgrade

Mark Wardle17:03:44

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.

Mark Wardle17:03:17

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.

Mark Wardle21:03:45

Brilliant. Thank you. Assumed I was missing something. Many thanks.

hlship23:03:51

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.

hlship23:03:48

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.

hlship23:03:07

Then I found out I can't re-create my original project.

hlship23:03:17

Now I'm into ~/Library/Caches/JetBrains/IdeaIC2020.3 looking for things to delete.

hlship23:03:44

Ok, got my original project working again with Leiningen after finding and deleting all .iml files in my workspace.

cfleming23:03:35

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.

hlship23:03:59

Jeez! Sorry to spam this! I thought I had started a fresh thread. It's been that kind of day.

cschep21:03:52

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.

Azzurite21:03:25

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

cschep21:03:17

is there a way to say hyphen’s don’t split words?

cschep21:03:38

i noticed that double click on a word with a hyphen selects the whole thing

cschep21:03:20

i dunno maybe i don’t want to do that.. does anyone have a preference either way?

imre21:03:06

I'd try expand selection

cschep21:03:58

i’m not familiar with that

cschep21:03:01

any insight?

imre22:03:43

sorry, it's extend selection, an intellij default command

imre22:03:12

works extremely well in clojure

3
dazld22:03:03

think it’s alt-up / down by default?

imre09:03:35

It appears so on the mac

cschep16:03:09

awesome, thanks!