cursive

Issues at: https://git.io/cursive-issues
cfleming 2021-03-15T06:33:47.178Z

@robert-stuttaford Sorry for the delay, I’ve been off-grid camping over the weekend. So my usual answer to that question is “sometime soon” which unfortunately often turns out to be a lie. However in this case I am actually working on a proof of concept so I can confidently say that it might actually be “soon” :-)

1❤️
cfleming 2021-03-15T06:36:40.178200Z

@raspasov @rextruong Right, sync basically works out which files you’ve changed and loads them all in dependency order. Load file also does that, except only starting with the file that you’re loading (i.e. that file and all its dependencies will be loaded if modified). sync will do that for all files, even if the current file doesn’t depend on them.

1👍
aratare 2021-03-15T06:38:01.178400Z

I see. I have a habit of loading files whenever I make any changes so I haven’t had a chance to use sync yet

cfleming 2021-03-15T06:38:02.178600Z

That sounds great. I’d be interested if that completely solves the problem for Clojure projects or if anything else is required.

robert-stuttaford 2021-03-15T06:55:40.178800Z

@cfleming you tease! 😆 seriously, that sounds fantastic, mate. sending you lots of Lisp energy from the Netherlands. good luck!

robert-stuttaford 2021-03-15T06:58:25.179Z

I habitually use load-file when making changes too, and eval-leftmost-form when doing stuff from inside (comment) blocks (like testing db code)

simongray 2021-03-15T08:48:29.181600Z

In the past, there used to be lightbulb that appeared when had the caret close to the beginning of a function/macro head, e.g. (|match [....] ....). This allowed me to pick a custom indentation level for e.g. the core.match/match macro. I think I was able to select it from the “context actions” menu when right-clicking too. Doesn’t seem to be around anymore?

cfleming 2021-03-15T09:09:19.181700Z

“Send top form to REPL” will work in comment blocks too, it sends the topmost form inside the comment, not the comment itself.

helios 2021-03-15T09:11:09.181900Z

Press Alt+Enter to open the context menu, regardless of the light bulb

helios 2021-03-15T09:11:35.182100Z

(depends if you can open the context menu there)

simongray 2021-03-15T09:31:10.182300Z

Nope, like I said the capability is gone

raspasov 2021-03-15T09:54:42.182500Z

@simongray check (macOS?): Preferences > Editor > Intentions > Search for “Clojure” > Enable all checkboxes

raspasov 2021-03-15T09:55:14.182700Z

Also check File > Power Save Mode (make sure it’s not enabled)

raspasov 2021-03-15T09:55:53.182900Z

(actually Power Save Mode probably doesn’t matter)

raspasov 2021-03-15T09:56:00.183100Z

But first one does.

conan 2021-03-15T09:56:47.183300Z

Ha! My whole intellij hangs if i try that it seems

conan 2021-03-15T09:56:58.183500Z

I'll investigate

simongray 2021-03-15T09:57:00.183700Z

they were all enabled and power save mode wasn’t on 😞

aratare 2021-03-15T09:57:43.184100Z

@conan Try with a dummy lein project first to see if it's working I reckon

1
raspasov 2021-03-15T10:00:34.184400Z

Hmm

raspasov 2021-03-15T10:01:28.184600Z

Did you try: File > Invalidate Caches/Restart ?

simongray 2021-03-15T10:18:33.184900Z

gonna try that in a moment and see if it has any effect. Thanks for taking your time to help, btw.

robert-stuttaford 2021-03-15T10:22:14.185100Z

do you mean the one that is bound to cmd-shift-p, @cfleming?

robert-stuttaford 2021-03-15T10:23:06.185300Z

i don't see a 'topmost' item here

robert-stuttaford 2021-03-15T10:23:16.185700Z

when i use cmd-shift-p, it evals the comment form

raspasov 2021-03-15T11:46:19.186Z

Of course! 🙂 Hope it helps… I accidentally disabled the Intentions once and it took me probably 15 min to find it in the Preferences. But I’m not sure why it’s not working for you in this case.

simongray 2021-03-15T12:22:15.186300Z

still not working after invalidating caches and restarting… this is so strange

simongray 2021-03-15T12:24:53.186500Z

ok, now I figured out the issue. It works with my own functions/macros, but not the ones in Clojure core - and apparently core.match/match is considered part of Clojure core despite being a library and the default indentation is not implemented correctly (it vertically aligns every form) and can’t be changed.

simongray 2021-03-15T12:25:32.186700Z

I need it to match the official indentation: https://github.com/clojure/core.match#example-usage

simongray 2021-03-15T12:25:54.187100Z

but Cursive seems to disallow it

imre 2021-03-15T12:36:26.187500Z

@robert-stuttaford that behaviour depends on where your caret's at. If you are somewhere inside (def db ... ) then cmdshiftP would eval the def. From your screenshot I'm assuming you are just after the def form.

conan 2021-03-15T18:09:04.187900Z

I've got it working. It breaks when I try to use a WSL2-based JDK, that was the issue. Indexing is slow and my REPL start times also seem down, but everything is working nicely. So I guess currently the choice is between Cursive performance (project on the Windows filesystem) and Linux performance (project on the WSL2 filesystem). It would be great to be able to start an nREPL from linux and connect to it in intellij without having to use a remote configuration.

conan 2021-03-15T18:22:57.188100Z

I've found that for symbols which cannot be resolved, you won't get the lightbulb. If you stick a (declare match) or something before it, you can get the lightbulb, then you can delete the declare

conan 2021-03-15T18:34:08.188300Z

may not be your issue, but i often get caught out by things that don't resolve for some reason

cfleming 2021-03-15T20:17:05.188500Z

@simongray That’s definitely not the case, Cursive doesn’t treat core forms as special in any way. My money is on conan’s suggestion - can you navigate from a usage of match to the declaration of it?

cfleming 2021-03-15T22:11:54.188700Z

You can also use Tools | REPL | Sync files in REPL, as recently discussed: https://clojurians.slack.com/archives/C0744GXCJ/p1615790200178200?thread_ts=1615527556.163100&cid=C0744GXCJ

2👍
aratare 2021-03-15T23:09:15.189200Z

Which Jdk were you using on wsl2, if you don't mind me asking?

dazld 2021-03-15T23:26:54.189600Z

@cfleming thanks - almost exactly what I wanted, but unfortunately the other way around - I want to reload namespaces that depend upon the one I’m working on - I’m working on some macro related stuff, and want the consumers of the macro to reload, so they get the new behaviour. it’s pretty dull having to go through each of the consumers and reload them..

dazld 2021-03-15T23:29:26.189800Z

The clojure.tools.namespace.repl/refresh approach and the (require '[the-ns] :reload-all) approaches both didn’t end up working out. I think the require... approach is reloading dependencies of the namespace (..right?), so not quite right, and the namespace.repl/refresh thing just didn’t seem to work - suspect it was a problem with retained vars in some places, but even restarting the system as part of it didn’t work.

dazld 2021-03-15T23:29:35.190Z

(wall of text, apologies)

cfleming 2021-03-15T23:29:56.190200Z

Yeah, there are some other use cases like this too - things like updating protocols and multimethods.

1👍
dazld 2021-03-15T23:33:40.190500Z

all three of those are some of the most fun bits of clojure too!

dazld 2021-03-15T23:41:48.191900Z

As a suggestion, some kind of tree reload might be great, both backwards with dependencies, and forward with dependents.

cfleming 2021-03-15T23:42:38.192100Z

Yeah, I can see that being useful. It would be pretty easy to accidentally reload your whole app, though, although I suppose that’s what you want if you’re changing some fundamental macro at the bottom of the pile.

dazld 2021-03-15T23:43:27.192700Z

It’s a trade off, for sure.

borkdude 2021-03-15T23:49:09.194500Z

Reloading your entire app is pretty easy: (require your.main :reload-all)

borkdude 2021-03-15T23:49:39.194800Z

I use this a lot from the REPL actually when I make such changes

dazld 2021-03-15T23:51:46.196600Z

Have unplugged now, but will try that later @borkdude thanks

dazld 2021-03-15T23:52:45.198100Z

Even a single level of dependents would be handy to reload, without traversing the whole tree..

dazld 2021-03-15T23:59:05.201900Z

“Reload direct dependents” would work great, the more I think about it. If I know I need to go further, navigate and execute that command iteratively is straightforward.