Fork me on GitHub
#cursive
<
2021-05-14
>
tengstrand09:05:36

I’m working on https://github.com/polyfy/polylith/issues/66 in the Polylith project. In that branch we have switched to use :deps when specifying which bricks to include in a project, e.g. in the https://github.com/polyfy/polylith/blob/issue-66/projects/poly/deps.edn project. It would be nice to switch to :extra-deps even in the root https://github.com/polyfy/polylith/blob/issue-66/projects/poly/deps.edn but right now I don’t want to do that, because I use Cursive and I problem I have is that Cursive doesn’t recognise the source code that is included using :extra-deps it only works when using extra-paths . It works in other IDE:s that I have tried, e.g. Calva, because they treat everything that is accessible from the REPL as code (this is my theory at least). It would be really nice if Cursive could support this too, so that src directories will be “green” even when they are defined as`extra-deps.` If this worked then all projects, development included, could be configured in the same way which would produce less code and be more consistent. What do you think @cfleming?

tengstrand09:05:15

Here is how it looks like when using :extra-paths and when using :extra-deps.

folcon14:05:32

Hey, has there been a regression around sending top form to REPL? It used to not send the comment block, so you could do this, where | is my caret:

(comment
  (identity coll)|)
Which now sends:
(comment
  (identity rows))
=> nil
Instead of:
(identity rows)
=> [1 2 3 4 5]

imre14:05:32

In your case I'd use the send form before caret command

imre14:05:07

top form works as you'd expect inside a comment when your caret is within (identity coll)

imre14:05:24

but not when it's directly in the comment form

imre14:05:45

That's been like that ever since I use cursive correction: ever since I started sending forms to the repl in cursive 🙂.

folcon14:05:48

That's interesting, in my experience cursive was aware if it was in a comment block and would not send the comment as part of the form...

folcon14:05:18

Which I would have expected as that's basically the standard workflow of using rich comments...

folcon14:05:58

I mean if this is the new behaviour fine, but it's pretty useful to be in a let block within a comment and not have to jump to the top most form to send it via send form before caret... I might be in the minority however 😃...

imre15:05:02

I think you misunderstand me. Probably I wasn't clear enough.

imre15:05:49

Standing here and issuing send top form:

(comment
  (identity |coll))
Should still send (identity coll) to the repl

imre15:05:38

But if you're outside of the 'top' form you are trying to send, then from that position the correct 'top' from is indeed the comment

imre15:05:08

I use this all the time

imre15:05:26

If I'm within a let block within a comment, I'll use send top and it'll send the let

imre15:05:13

If I'm just outside (after) the let block, I need to use another command, 'send form before caret to repl'

imre15:05:51

And I haven't seen the behavior change in the past 4+ years in this regard

pez19:05:56

When would you ever want the comment form to be sent?

imre19:05:49

I don't think I'd want that but the behavior is more consistent this way imo

imre19:05:34

For a command named 'send topmost form', I'd be rather surprised if that worked like 'send form before caret' under certain conditions

Alex Miller (Clojure team)19:05:27

this is why the principle of least surprise is a fallacy. people are surprised by different things

☝️ 3
yes 2
pez20:05:44

@imre , however, you would never get the surprise, since you wouldn't try to send the comment form. 😎

pez20:05:14

Also, with the cursor at the top level, near some form. What should be sent if top level is requested? If we think of (comment …) as creating a new top level (since no-one wants to send comment forms anyway) it can send the same thing as would be sent in the top level case. Which, I think should be something, rather than nothing.

cfleming21:05:01

My intention was definitely that this should work as @folcon expected, since I also can’t imagine when you’d ever want to sent the comment.

dpsutton21:05:25

(comment
  (fire-missiles!)
  |
  (+ 1 1))
what is intended here, with | being cursor?

dpsutton21:05:51

i implemented this feature in clojure-mode, and luckily emacs's idiom is last sexp almost all the time. so i would fire missles in emacs

emilaasa21:05:43

Isn't it possible to just ignore the comment form completely? As if you were in the "root"

emilaasa21:05:41

Treat it the same as:

(fire-missiles!)
|
(+ 1 1)

cfleming21:05:56

I’m not sure what would be intended, but yes, it should be treated as if the user were at top level, so probably nothing should be sent.

👍 6
3
folcon23:05:49

I did an update and the behaviour seems to be what I expected 😃...

👍 2
folcon23:05:05

Thanks for chiming in @cfleming 😃...