Fork me on GitHub
#cursive
<
2017-01-24
>
cemerick01:01:44

@cfleming never once did I consider that the pprinting was being done client-side

cfleming01:01:27

@cemerick Yeah, I suddenly realised that that might not have been obvious

cemerick01:01:04

I figured you were adding a shaded fipp dep to every classpath and using it in cursive middleware, etc

cfleming01:01:39

No, I just lex (and parse in a very primitive way) the output string coming back from nREPL.

cfleming01:01:49

(or whatever else is returning values to me).

cfleming01:01:42

Again, it’s swings and roundabouts - what I have will work for CLJS as soon as I get a dedicated CLJS REPL going.

cfleming01:01:07

But it’s harder for the user to customise - I can expose knobs, but customised renderers are trickier.

cemerick01:01:04

yeah, it's a very uncomfortable notion, insofar as I'm so used to always having pprint or an equivalent available

cemerick01:01:25

I'll forgive you when a webkit output view shows up 😜

cfleming01:01:38

Well, as far as I can tell, you should be able to use the middleware I sent and just disable pprinting in Cursive

cemerick01:01:49

yeahyeah, should be a snap

cemerick01:01:08

I'm still confused re: the syntax highlighting though.

cemerick01:01:23

it sounded like you were using fipp in order to get that somehow, but clearly that's not the case

cfleming01:01:30

Nope, I have my own lexer

cemerick01:01:33

so why bother with all the trouble of client side pprinting at all?

cfleming01:01:30

Well, if pprinting is enabled, I lex and (somewhat, basically just data structures) parse using Cursive’s existing machinery, then use a custom fipp on that.

cfleming01:01:38

If it’s not, I just lex and highlight.

cfleming01:01:17

Other advantages are that the syntax highlighting colours are what the user expects (they’re the same as in the editor, which will not be the case if using e.g. puget)

cfleming01:01:56

And it’s just generally less intrusive on the user app - after all this time, I’m still not used to the idea that dev tooling has to be injected into the running app.

cfleming01:01:21

Not doing that reduces all sorts of version conflicts etc that Cider has suffered from

cfleming01:01:50

Plus, it will work with non-nREPL things.

cfleming01:01:03

When I ever get around to adding them.

cemerick01:01:23

do you have any sense of the socket repl stuff? I actually don't really have a dog in the fight anymore, but I had been figuring there'd be more activity at some point

cfleming01:01:18

I’m planning to add support shortly.

cfleming01:01:36

It’s surprisingly tricky from a UI point of view. It involves explaining to users the difference between RPC and streaming REPLs, making them choose one and then supporting the various tradeoffs depending on what they choose.

cfleming01:01:52

Technically, it’s pretty easy.

karol.adamiec16:01:33

question about test integration. seems to me that cursive somehow holds on to old test definition. After overwriting example test = 1 0, with sth that passes it still reports that original as failing? how can i reset short of stopping the lein process that remote repl works on? redefines seem not to work...

karol.adamiec16:01:54

stopping process and starting helps and it goes away. do not know how often one can run into that, maybe i am unlucky. Is there something specific at play with regards to test integration that might shed light on such behaviour?

felipehummel19:01:45

Do you guys know if I can get the form/something under caret in a REPL command? Something like (pprint $form)

rauh19:01:38

@felipehummel You can def do that with a macro

felipehummel19:01:38

@rauh how? What should I put in the command to be executed?

rauh19:01:01

Yeah that part is little tricky

rauh19:01:15

1. Grow selection 2. Copy. 3. Focus REPL window 4. Paste

rauh19:01:07

#3 "Jump to REPL" is provided by Cursive. I have a macro that uses it

felipehummel19:01:03

Oh, I guess I wasn't clear. I'm talking about this: https://cursive-ide.com/userguide/repl.html#repl-commands I'd like a command that gets whats under my caret (or something similar) and pass it to a function. Like: (my-pretty-print-function $form-under-caret)

rauh20:01:26

@felipehummel Oh I see, I wrote a macro like that (actually calling clojure.repl/doc on the symbol) but it's not pretty and was a little flaky

cfleming21:01:05

@felipehummel So currently you can only get the selection with ~selection (although I think I just saw a bug in that - gah). If you’d like more possibilities, please file an issue - I’m definitely interested in hearing about use cases.

felipehummel21:01:59

The use case I was thinking about was to show a pretty-printed version of a Prismatic Schema in the repl. We use extensively schemas and sometimes we want to take a quick look at the schema definition. As schemas are normally combined/merged with one another, going to the definition of the schema doesn't always give the answer.

tmarble21:01:35

Newbie cursive user here.. I'm trying to connect to a remote REPL and I get the "REPL run configuration is incorrect - no module selected" error. However in the REPL configuration Context Module dropdown there are no choices??

cfleming21:01:07

Hi @tmarble, what that probably means is that none of your modules have Clojure attached to them.

cfleming21:01:11

How did you set this project up?

tmarble21:01:40

I just tried to import https://github.com/martinklepsch/tenzing out of the box

cfleming21:01:43

Interesting, I think the issue is that that project.clj has no Clojure dependency.

cfleming21:01:00

My memory is failing me on how eval-in-leiningen is handled, one sec.

tmarble21:01:01

In task-options! I set repl {:port 8082} and then configured that port in the "MyREPL" config which is based on Remote

cfleming21:01:30

@tmarble Sadly, Cursive currently doesn’t support boot out of the box - it’s very near the top of my list, though. How people usually handle this is to do this: https://github.com/boot-clj/boot/wiki/For-Cursive-Users

cfleming21:01:51

That generates a project.clj using the deps from your boot build, which Cursive can then import.

cfleming21:01:09

The problem is that tenzing already has a project.clj - I don’t know why that would be.

tmarble21:01:06

hmm i must have deleted project.clj... let me regenerate it and try again

superstructor21:01:27

I do above with boot, only issue I have with it is I regularly forget to run boot lein-generate so the deps in Cursive are out of date until I remember to run it again.

tmarble21:01:37

the project.clj in the repo is for the lein-template... the generated example (from lein new) only has build.boot

cfleming21:01:23

Umm - so this is a boot project which creates a lein template which creates boot projects?

tmarble21:01:36

hahaha, yeah

cfleming21:01:15

Ok, so that project.clj is really like a static resource, and is not the project definition for tenzing itself.

cfleming21:01:06

Wait - but it also doesn’t have a build.boot file?

tmarble21:01:00

I just generated a new example, did lein-generate and Cursive is indexing now..

cfleming21:01:22

What are you trying to do - work with tenzing itself?

tmarble21:01:16

nope... just figure out how to get Remote REPL to work in cursive. In this example just one (1) CLJS REPL... Ultimate goal is to have CLJ REPL (web server) and CLJS REPL (Weasel connected browser REPL)

tmarble21:01:55

OK, yay!, now Edit Configurations Clojure REPL -> Remote has the Context Module

tmarble22:01:04

Hmm.. i ran 'boot dev' per the tenzing instructions... and it says nREPL started on 8082... but when I try to start the Cursive REPL it appears to start a new nREPL on a different port?

cfleming22:01:00

@tmarble It shouldn’t if you’re using a Remote REPL - can you send a screenshot of your REPL run config?

tmarble22:01:48

OH.. in the REPL window it says LOCAL!

tmarble22:01:59

hmmm.. how to I make that Remote??

cfleming22:01:35

You shouldn’t have to - your REPL run config looks ok, but it seems to be running a local config instead of a remote one.

tmarble22:01:44

How come? 😛

cfleming22:01:59

This is a project you just created from a template, right? Nothing sensitive in there?

tmarble22:01:21

want me to push it to github?

cfleming22:01:27

Ok, can you zip the project up and send it to <mailto:[email protected]|[email protected]>?

cfleming22:01:32

Sure, or that - either is fine.

cfleming22:01:56

If you push it I’ll need the config that lives under .idea

tmarble22:01:07

i'll give you the whole shebang

tmarble22:01:29

Following import i did 'Add project' 'Add SDK', opened a terminal, ran 'boot dev', then made the new Remote REPL configuration and tried to connect to it

cfleming22:01:56

@tmarble Arg - one thing that’s missing is the REPL config itself. Could you open your run config, select “share” and then add the file and push it?

cfleming22:01:18

By default run configs aren’t added to the project, they’re user-local.

cfleming22:01:56

@tmarble Ok, that all looks good. I can’t run boot dev for some reason, I get “Unable to resolve symbol: update in this context, compiling:(pandeiro/boot_http/impl.clj:156:36)"

cfleming22:01:26

But when I run the REPL it says: Connecting to remote nREPL server... Error connecting to localhost:8082 - class java.net.ConnectException: Connection refused

cfleming22:01:34

Which is as it should be.

cfleming22:01:29

I’m wondering if your REPL config has got itself into a funky state somehow. Could you try deleting it and recreating it, just to be sure?

tmarble22:01:45

first let's get your boot dev working

tmarble22:01:15

do you have things setup in ~/boot (see my Boot/ directory) -- save what you have if already present

cfleming22:01:57

~/d/cursive-bugs> ls ~/.boot
boot.properties cache           lib             tmp

cfleming22:01:25

But I don’t use boot for anything except sporadic testing, yet

tmarble22:01:31

cp Boot/{boot.properties,profile.boot} ~/.boot/

cfleming22:01:33

So I can delete all of that with no problem

tmarble22:01:45

shouldn't need to delete

tmarble22:01:10

then, in a terminal, do boot dev again

cfleming22:01:12

Ok, done - boot is supposedly deving

cfleming22:01:23

Downloading things...

tmarble22:01:40

it'll take 30 seconds AFTER it says listening on 8082 before it's truly ready

tmarble22:01:57

ends with Elapsed time: ....

cfleming22:01:53

Yep, I’ve made it that far

tmarble22:01:11

Now try to connect the Remote REPL

cfleming22:01:33

Connecting to remote nREPL server...
Clojure 1.8.0
(+ 1 2 3)
=> 6

tmarble22:01:49

ok, now my turn... i'll delete the project

tmarble22:01:55

it's ok if it deletes all of .idea, right?

cfleming22:01:10

Yeah, that will all be recreated when you import.

tmarble22:01:05

Import project... tenzing3

tmarble22:01:35

The project file .idea already exists, would you like to overwrite it?

tmarble22:01:39

I assume yes

tmarble22:01:13

open terminal, run boot dev

tmarble22:01:41

Edit configurations...

tmarble22:01:15

Do I edit the Defaults / Clojure REPL / Remote -or- just add a new REPL config?

cfleming22:01:29

Add a new one

cfleming22:01:52

The defaults are used as a template for new configs when you create them.

tmarble22:01:59

crap... no Context module

cfleming22:01:24

Ok, I’m going to import the project instead of opening your files, one sec

cfleming22:01:53

Actually, I’ll send you a PM, this is getting pretty specific to your case