Fork me on GitHub
#cursive
<
2016-10-27
>
cfleming19:10:46

@deas Yes, that’s very strange. What’s inside that directory?

cfleming19:10:10

Do you have a library that references that somehow? You can see them in File-&gt;Project Structure

deas19:10:23

@cfleming Advanced optimization compiled Javascript code. No clue how this folder ended up being library root. I think we can ignore the issue unless other people see similar things.

deas19:10:36

@cfleming Will check for refs when I'm in front of the box tomorrow morning.

cfleming19:10:12

Ok, great. Let me know if you can’t figure out how that’s getting marked. I’ve actually never seen that type of directory marking before.

snoe20:10:49

Is it possible to have the output of a repl command inserted (or replace the evaled form) in the edit buffer?

snoe20:10:19

And is it possible to access metadata about the current buffer (like the path name)?

snoe20:10:11

I'm trying to run refactor-nrepl commands that change my current file like:

(with-open [conn (repl/connect :port (Integer/parseInt (slurp ".nrepl-port")))]
  (-> (repl/client conn 1000)
      (repl/message {:op "clean-ns" :path "src/something/example.clj"})
      first
      :ns
      read-string))

ericnormand20:10:46

I have a question

ericnormand20:10:56

how do I see the result of macroexpansion on my macros?

ericnormand20:10:03

I'd like to test them

cfleming20:10:22

@ericnormand You need to have a REPL running. Then Tools-&gt;REPL-&gt;View macro expansion

cfleming20:10:36

(or whichever key you have that bound to, if any).

cfleming20:10:59

You’ll need your cursor over a macro form to expand.

cfleming20:10:16

You’ll see a window which initially shows your original unexpanded form.

cfleming20:10:49

Then you can put the cursor anywhere in the form, and either hit the right arrow icon in the toolbar, or Ctrl/Cmd-Right

cfleming20:10:20

That will expand from the root down to the point your cursor is over, so you can selectively expand the parts of the macro you’re interested in.

ericnormand20:10:57

thanks, mate!

ericnormand20:10:05

is that documented somewhere?

cfleming20:10:28

@snoe Hmm, no - currently the only thing that can be substituted into a REPL command is the selection.

cfleming20:10:39

The path would be a nice addition to that.

cfleming20:10:19

@ericnormand Sadly, no - the doc that exists is at https://cursive-ide.com/userguide/ but it is sadly incomplete.

puzzler21:10:17

The x button to "interrupt current execution" doesn't seem to reliably work. Anyone else have this issue? I really don't like having to kill the entire REPL due to one hung evaluation.

cfleming21:10:43

@puzzler Unfortunately I don’t think there’s more I can do - I just call the nREPL interrupt operation.

snoe21:10:26

@cfleming how about being able to echo the output of a repl command into a file buffer instead of the repl output?

cfleming21:10:52

That’s not there now but it sounds like a good improvement.

cfleming21:10:08

I wanted to do that for standard REPL execution, but the problem is that I end up with a combinatorial explosion of commands (execute top-level form and print output, execute top-level form and substitute into editor, execute previous form and… etc).

cfleming21:10:18

Vim’s verb-object model works much better for that.

snoe21:10:52

yeah, I'm looking to hoop it up to ideavim, is it possible to expose :actions for just vim users?

snoe21:10:14

like, don't have menu items

snoe21:10:48

oh I meant for stuff like execute top-level form and substitute into editor that gives the combinatorial explosion

cfleming21:10:17

So… I don’t think so at the moment. How would you want that to work? I’m almost totally Vim-ignorant.

cfleming21:10:08

i.e. I think the sort of action you’re talking about is not a standard IntelliJ action.

snoe21:10:44

Right now I have a mapping like noremap cpp :action :cursive.repl.actions/run-last-sexp<CR> which works great. But, like you said, there aren't as many repl actions in cursive as say cider. I assume that's because you're trying not to overwhelm people. However as a vim user if they existed I could take advantage of them even if they weren't exposed to most users.

cfleming21:10:23

So you’d like smaller more composable actions? What sort of actions would be helpful?

snoe21:10:26

so I would like to add noremap c!! :action :cursive.repl.actions/eval-last-sexpr-and-replace<CR>

snoe21:10:46

even if they weren't composable

cfleming21:10:54

I don’t think there’s a way to have lots of actions but only expose some.

snoe21:10:10

one composable one I would like is to get the first and last char positions of a sexp

cfleming21:10:30

All actions are by default visible. I guess I could expose them all, perhaps others might like to use those instead of the existing ones.

snoe21:10:40

with that I think I could build motions for inner/outer form

cfleming21:10:45

What would I do with those positions? Select from start to end, or something?

snoe22:10:51

right if you look at https://github.com/guns/vim-sexp#text-object-selections-visual-operator-pending a motion just defines the bounds to operate on, so I could write a vimscript function that called the cursive action to get the bounds of the curent form, omap af call get_current_form_bounds() that and it'll be available to delete (`daf`) or select (`vaf`) etc...

cfleming22:10:45

But IdeaVim doesn’t support vimscript, right?

snoe22:10:17

hrm, darn I'm still learning the differences.

cfleming22:10:15

Hehe - it’s tricky for me to understand since I don’t understand vim, to begin with.

cfleming22:10:29

And then the subtleties of IdeaVim, even less.

cfleming22:10:51

I do want to figure it out so I can help people get it set up.

snoe22:10:55

cool, I'll play with some static positions and see what's possible, there's stuff like :goto that can jump to byte indices