Fork me on GitHub
#cursive
<
2017-11-09
>
steveb8n00:11:14

I’m on EAP release FWIW

gjnoonan21:11:30

@cfleming When doing "Help -> Show Cursive Cheat Sheet" on the latest EAP it exports a file cheat-sheethtml (without the dot)

cfleming21:11:13

Will be in the next build. I don’t know how that works correctly in Chome on OSX but it does.

cfleming21:11:37

(which is why I hadn’t noticed)

gjnoonan21:11:06

Chrome detects the doctype in any file IIRC

manutter5121:11:11

This is weird: If I try to create a new Clojure namespace called idea-figwheel-repl at the top level of my src folder, Cursive throws a “String index out of range: 0” error.

manutter5121:11:02

The Create dialog stays open, but if I click the Create button again, it tells me the file is already there, and if I cancel, the file shows up, but I can’t open it.

manutter5121:11:48

Just curious if anybody else can reproduce that with the specific namespace idea-figwheel-repl at the top level of your src directory.

cfleming21:11:26

I get the exception, but the file is created and opened in the editor.

cfleming21:11:51

The problem is that the namespace is created with a leading ., so .idea-figwheel-repl

cfleming21:11:58

I’ll fix that.

manutter5121:11:13

Interesting.

cfleming21:11:24

I suspect the difference might be that I don’t use tabs, one sec

cfleming21:11:53

No, even with tabs I still get the file opened.

manutter5121:11:16

Ok, I’m trying an “Invalidate Caches” etc, just for grins

manutter5122:11:20

No change, the dialog stays up, and if I cancel, the file shows up, but I can’t open it.

manutter5122:11:52

@cfleming awesome, thanks much

cfleming22:11:25

You can probably just create a file rather than a namespace in that directory, call it idea-figwheel-repl.clj and add the namespace yourself.

manutter5122:11:39

Yeah, that’s what I did, and that works fine.

manutter5122:11:02

I just posted it here at the end of the day because it seemed weird and I wondered what was going on.

cfleming22:11:13

Definitely a bug, thanks for the report.

gfredericks22:11:47

I am using a leiningen plugin that does its thing by adding a hook to the repl task

gfredericks22:11:08

and I'm 87% sure that cursive, even when you ask it to use lein to start the repl, doesn't do it via the repl task

cfleming22:11:35

Do you want to bet?

cfleming22:11:42

87% is pretty good odds.

gfredericks22:11:02

I will bet you 0.5 testnet BTC that I am correct

cfleming22:11:22

I’ll get you my testnet address.

cfleming22:11:35

Here’s how that works.

cfleming22:11:44

(let me just dig the code up to make sure)

cfleming22:11:31

Cursive does actually invoke the repl task, but it does it using lein’s trampoline in order to capture the created classpath/command etc

cfleming22:11:52

It also does a significant amount of its own hooking, so something like that may be causing problems.

gfredericks22:11:04

I'm trying it out with trampoline right now

gfredericks22:11:49

trampoline does not break it

gfredericks22:11:07

is there an easy way to figure out what cursive is running exactly so I can debug more?

cfleming22:11:28

Not really - is the plugin public?

cfleming22:11:22

What does the hook do?

gfredericks22:11:28

I'm 87% sure this doesn't have to hook the repl task and could just be a general :injections entry, but writing lein plugins like that is hard and I would like to avoid modifying it if I can

cfleming22:11:34

So that plugin doesn’t hook the repl task directly, it hooks the resolve task and in that hook, hooks the repl task.

cfleming22:11:00

Cursive however does not call the resolve task, in fact I don’t even know what that is/does.

cfleming22:11:20

But I assume it’s usually called as part of the repl task? Seems weird though.

cfleming22:11:44

I can’t see why it would do that.

gfredericks22:11:48

yes, I think it might be an attempt to avoid loading some code if not necessary

cfleming22:11:03

Cursive has taken that at its word.

gfredericks22:11:06

see the comment on lines 27 etc.

cfleming22:11:59

Well… that’s a bummer.

gfredericks22:11:08

but in any case, is that indirection the cause?

gfredericks22:11:32

it's hard to imagine what leiningen use cases don't involve resolve-task being called :thinking_face:

cfleming22:11:39

I believe so, yes, but I’m only 87% sure.

gfredericks22:11:56

okay, so I could test this by hooking the repl task directly myself

gfredericks22:11:04

and that would potentially fix it?

cfleming22:11:12

Potentially.

gfredericks22:11:53

much stranger problem now

gfredericks22:11:51

but I should debug more on my own first

cfleming22:11:32

Ok, but don’t spend too long on it - Cursive does all kinds of wacky things, which I can debug more easily.

gfredericks22:11:08

it's complicated by the fact that I'm actually working on a plugin that wraps this one, so I should at least figure out which plugin is at fault

gfredericks22:11:31

okay I think I confirmed that even using the regular lein-shorthand plugin cursive has the problem, even if I do the repl hook directly

gfredericks22:11:08

I can create a debug branch of lein-shorthand with the hook modification if that would make things easier for you

cfleming22:11:24

Sure, I’ll take a look at it.

cfleming22:11:54

Looking at that plugin, I’m tempted to say that you get what you deserve for doing such things, but that’s pretty much lein for you.

gfredericks22:11:32

that is pretty much lein for me

gfredericks22:11:50

if you have alternate impl ideas, that'd be useful too