cursive

Issues at: https://git.io/cursive-issues
2021-03-17T00:53:02.001600Z

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

imre 2021-03-17T08:36:56.005900Z

oh, this seems to be working again

imre 2021-03-17T08:37:07.006100Z

First time I had success with it in months

cfleming 2021-03-17T09:43:51.006300Z

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.

imre 2021-03-17T12:12:50.011200Z

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

2021-03-17T15:56:25.016900Z

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?

cfleming 2021-03-17T19:41:32.021100Z

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

cfleming 2021-03-17T20:26:06.022400Z

Thanks, I’ll try to reproduce that.

1
2021-03-17T00:53:22.002Z

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

imre 2021-03-17T16:44:34.017300Z

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

imre 2021-03-17T16:44:41.017500Z

but at least it now appears

onetom 2021-03-17T01:31:49.002400Z

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

onetom 2021-03-22T11:31:50.049100Z

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

2021-03-17T01:46:19.002700Z

mind elaborating on this?

cfleming 2021-03-17T01:57:48.002900Z

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.

👍 1
cfleming 2021-03-17T01:59:12.003100Z

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

cfleming 2021-03-17T01:59:39.003400Z

Does normal C+P not work?

cfleming 2021-03-17T02:00:23.003600Z

I really need to document that thing.

cfleming 2021-03-17T02:01:35.003800Z

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

💯 3
cfleming 2021-03-17T02:02:15.004Z

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

2021-03-17T02:20:39.004200Z

🤯

2021-03-17T02:39:12.004400Z

like, cmd+p?

2021-03-17T02:40:31.004600Z

This buffer is more like an autocomplete buffer

2021-03-17T02:40:40.005Z

I’m unable to focus it at all.

2021-03-17T02:41:50.005300Z

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

cfleming 2021-03-17T03:41:23.005500Z

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

aratare 2021-03-17T09:50:17.011100Z

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

Azzurite 2021-03-17T15:08:56.013900Z

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

mikejcusack 2021-03-19T17:18:33.037500Z

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.

R.A. Porter 2021-03-17T15:25:12.016200Z

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?

imre 2021-03-17T15:34:09.016300Z

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

➕ 1
imre 2021-03-17T15:34:57.016500Z

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

R.A. Porter 2021-03-17T15:35:26.016700Z

👍

Mark Wardle 2021-03-17T17:19:44.020600Z

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.

hlship 2021-03-19T23:21:51.039300Z

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.

hlship 2021-03-19T23:41:48.039500Z

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.

hlship 2021-03-19T23:44:07.039700Z

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

hlship 2021-03-19T23:44:31.039900Z

hlship 2021-03-19T23:48:17.040300Z

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

hlship 2021-03-19T23:52:44.040700Z

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

cfleming 2021-03-19T23:54:35.040900Z

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.

hlship 2021-03-19T23:54:59.041200Z

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

Mark Wardle 2021-03-17T17:22:17.020900Z

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.

cfleming 2021-03-17T20:00:45.021300Z

You can do this, see here: https://cursive-ide.com/userguide/deps.html#working-with-aliases

👍 1
cfleming 2021-03-17T20:03:03.021600Z

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.

cschep 2021-03-17T21:20:52.024300Z

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.

cschep 2021-03-17T21:20:58.024400Z

cschep 2021-03-17T21:21:17.025Z

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

cschep 2021-03-17T21:21:38.025500Z

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

cschep 2021-03-17T21:29:20.026Z

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

imre 2021-03-17T21:31:06.026400Z

I'd try expand selection

imre 2021-03-17T21:32:26.026700Z

@cschep ^

Azzurite 2021-03-17T21:32:30.026800Z

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

cschep 2021-03-17T21:32:58.027700Z

i’m not familiar with that

cschep 2021-03-17T21:33:01.027900Z

any insight?

imre 2021-03-18T09:11:35.033600Z

It appears so on the mac

cschep 2021-03-18T16:12:09.033800Z

awesome, thanks!

Azzurite 2021-03-17T21:37:25.028200Z

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

Azzurite 2021-03-17T21:43:24.028900Z

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

Azzurite 2021-03-17T21:47:09.029400Z

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

Azzurite 2021-03-17T21:51:16.029900Z

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

Mark Wardle 2021-03-17T21:54:45.031100Z

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

imre 2021-03-17T22:06:43.031300Z

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

imre 2021-03-17T22:07:12.031500Z

works extremely well in clojure

➕ 1
dazld 2021-03-17T22:23:03.031900Z

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

cfleming 2021-03-17T22:34:50.032500Z

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.

cfleming 2021-03-17T22:37:13.032700Z

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.