calva

Wednesdays you might find @U0ETXRFEW in the Gather Calva space. Invite is https://gather.town/invite?token=GZqrm7CR and the password is `Be kind`.
bringe 2020-08-12T00:32:35.227200Z

Hey Calva friends. I've (re)implemented repl command history for the new output/repl window. It works the same as with the old repl window. alt+up to go previous history, alt+down to go next history. These shortcuts are only overidden in the repl window (in normal editors they map to move line up/down). Please give this vsix a spin and let us know if you see any issues. It contains 1 or 2 other changes on dev as well, including @cb.lists's fix for not overriding the default binding for esc. https://7490-125431277-gh.circle-artifacts.com/0/tmp/artifacts/calva-2.0.120-fix-740-allow-default-esc-keybind-feature-add-repl-history-021e2239.vsix

1
πŸŽ‰ 1
pez 2020-08-12T11:20:08.227600Z

Nice! Two things I notice: 1. When I send a form to the repl from another file, it seems to kill the history. 2. alt+up/down completely replaces the move line up down built-in command. I know structural autists frown on me using that a lot, but I do. I think it is cool that we use such an accessible shortcut, but also that it should only work as the history shortcut when the cursor is behind the last form in the file (or the last prompt, if no form has been entered).

bringe 2020-08-12T17:40:29.244800Z

Thanks, I'll look into the history killing issue. Yeah I was considering this with the shortcut, but I thought I remembered discussing before that if this is only the case in the output window then it's not a big deal. I'll see about detecting the position of the cursor when the command is issued, and deferring to the move line commands if not after the last prompt

bringe 2020-08-12T17:40:56.245Z

Also going to put a note in the output greeting about the history commands

pez 2020-08-12T19:00:59.248Z

I think we can detect cursor position and update a when context in a selectionChanged observer/watcher.

πŸ‘ 1
borkdude 2020-08-12T12:45:02.228100Z

I might convert ... https://twitter.com/borkdude/status/1293527889690988544

πŸ‘ 2
4
1
2
❀️ 1
mkarp 2020-08-12T13:11:29.229900Z

Just switched to latest Calva with the new REPL window and it’s quite nice πŸ‘ Had to change some habits, but after a few hours productivity is up again. Thank you @pez!

1
❀️ 1
pez 2020-08-12T13:16:07.230400Z

Sounds a bit like a habit you could challenge is using the repl prompt. πŸ˜ƒ

mkarp 2020-08-12T13:17:47.230500Z

I’m a bit uncertain what you mean by REPL prompt πŸ™‚

mkarp 2020-08-12T13:17:57.230700Z

You mean in the old REPL window?

mkarp 2020-08-12T13:19:45.232500Z

I really like that the REPL window behaves more like a normal file editor now. I can place a cursor at any previous expression and eval it many times in a row. Previously I’d have to use the arrow keys to go previous expressions, which could be tedious if you want to go even 3 steps back

pez 2020-08-12T13:19:50.232600Z

The new repl window also has a prompt, right? What I am driving at is Rich comments: https://betweentwoparens.com/rich-comment-blocks#rich-comment

mkarp 2020-08-12T13:22:27.232900Z

Ah yes, it has a prompt. In the old REPL window it behaved more like a prompt because of the arrow keys navigation. The new one behaves more like a file which I like

borkdude 2020-08-12T14:12:37.233400Z

How "open source" is VSCode?

agold 2020-08-12T14:15:02.233600Z

My understanding is that the editor itself is open source but extensions for remote editing, WSL, Docker, etc., are proprietary.

borkdude 2020-08-12T14:17:02.233800Z

Why would they make the remote editing plugin closed source?

borkdude 2020-08-12T14:24:28.234300Z

thanks

borkdude 2020-08-12T14:25:23.234900Z

Does clj::proj.core mean: clojure, proj.core namespace? In CLJS you would get cljs::proj.core?

borkdude 2020-08-12T14:30:35.235300Z

Can you change the keybinding of forward slurp? I'd like to keep my mission control keybindings

borkdude 2020-08-12T14:40:15.235800Z

Oh I see, that's a VSCode thing, not Calva per se.. duh. Sorry, new to this :)

borkdude 2020-08-12T14:42:14.236400Z

Awesome, I now set it to what I'm used to in emacs :) ctrl-)

🀘 2
pez 2020-08-12T14:48:09.236700Z

the prefix just says which repl you are connected to. In Calva there is only one or two repl’s per workspace/window. So in a clj+cljs project you are either connected to the clj repl or to the cljs repl.

borkdude 2020-08-12T14:48:30.237300Z

Now I hope the SSH remote plugin will be free and around forever (open source fears)

borkdude 2020-08-12T14:51:52.237400Z

Ajajaj... you can't connect to more REPLs?

pez 2020-08-12T14:52:00.237600Z

There is also Theia, which I think might help in keeping MS taking the right decisions. πŸ˜ƒ

borkdude 2020-08-12T14:53:15.237800Z

At work I have a multi-repo where I need to be connected to two Clojure REPLs sometimes

borkdude 2020-08-12T14:53:21.238Z

I guess in that I'd just open two Windows?

pez 2020-08-12T14:54:03.238200Z

β€œAjajaj” sounds oddly Swedish. Dutch? πŸ˜ƒ Anyway, yes, there is https://github.com/BetterThanTomorrow/calva/issues/76

borkdude 2020-08-12T14:54:26.238500Z

We also say it in Dutch ;)

pez 2020-08-12T14:56:09.238700Z

Yeah, two windows. This is written by someone who doesn’t really understand the multirepo concept, but anyway: https://calva.io/workspace-layouts/

pez 2020-08-12T14:57:16.239Z

For me the most pressing need for one more REPL connection is that I want a babashka REPL always handy. πŸ˜ƒ

borkdude 2020-08-12T15:00:09.239200Z

:-D

borkdude 2020-08-12T15:01:54.239800Z

Calva doesn't have sort namespaces (like Emacs clojure-mode: clojure-sort-ns)?

pez 2020-08-12T15:03:45.240900Z

No. That would be nice. I think @slack1038 had it a branch there a long while ago...

borkdude 2020-08-12T17:30:18.243800Z

> ctrl+shift+alt+up Select Backward Down Sexp > ctrl+shift+alt+down Select Forward Up Sexp makes sense right?

borkdude 2020-08-12T17:39:40.244100Z

Is it possible to make paredit also work in strings?

borkdude 2020-08-12T17:40:04.244600Z

The use case:

(deftest datafy-test
  (prn (tu/bb nil "(require '[clojure.datafy :as d]) (:flags (d/datafy Exception))")))
I'm editing the code inside the string. In emacs forward slurp etc. work.

bringe 2020-08-12T17:45:22.245400Z

Nice to hear people are seeing the benefits! I'm working on adding the history navigation at the prompt back, just as an added feature to what you mention above, because some users really wanted it πŸ˜„

bringe 2020-08-12T17:48:47.245600Z

My goal in my application for clojurists together this quarter is to add multi-project/repl support to Calva πŸ˜„ . Want to add this anyway but the funding will help speed things up.

borkdude 2020-08-12T18:06:01.247Z

Does Calva have completions when connected to an nREPL server? It seems that it doesn't work?

bringe 2020-08-12T18:20:28.247100Z

It should if cider-nrepl is loaded as a dep in that repl

borkdude 2020-08-12T18:20:42.247300Z

Ah.

borkdude 2020-08-12T18:20:55.247500Z

That might be the problem, I connected to my own REPL. Thanks

bringe 2020-08-12T18:21:03.247700Z

Welcome!

borkdude 2020-08-12T19:17:38.248200Z

I think I have screwed up a couple of default keybindings. Is there a way to restore them? ;)

pez 2020-08-12T19:23:13.248800Z

Doesn't the VS Code GUI for shortcuts have a button for resetting to defaults?

borkdude 2020-08-12T19:25:30.249Z

I haven't noticed it

borkdude 2020-08-12T19:26:04.249200Z

Oh I guess when you right click

borkdude 2020-08-12T19:26:20.249400Z

borkdude 2020-08-12T19:26:26.249900Z

I'm such a VSCode n00b ;)

borkdude 2020-08-12T19:27:07.250100Z

But guess what. I helped out someone at an online meetup tonight what was trying to evaluate something in the Calva output window.

borkdude 2020-08-12T19:27:31.250300Z

I told him: do it from the buffer, ctrl+enter. And it worked. Haha.

pez 2020-08-12T19:29:03.250700Z

So awesome!

pez 2020-08-12T19:30:30.250900Z

The output window should work the same, though. alt+enter and ctrl+enter. If it didn't, then there is a bug somewhere.

borkdude 2020-08-12T19:30:51.251100Z

I think he wasn't used to a recent change or something

borkdude 2020-08-12T19:31:28.251300Z

Getting the hang of it. So far my missing features are: undo-tree (which isn't on Calva, but VSCode in general) and structural editing in strings.

borkdude 2020-08-12T19:31:34.251500Z

And clojure-sort-ns

pez 2020-08-12T19:31:59.251700Z

The new repl was surprisingly disruptive for many.

pez 2020-08-12T19:32:31.251900Z

What do you miss about structural editing in strings?

borkdude 2020-08-12T19:32:57.252400Z

I tend to edit code samples in strings for sci/babashka tests

borkdude 2020-08-12T19:33:09.252600Z

Also the indentation is way off in code that's in strings

pez 2020-08-12T19:33:39.252800Z

I see. Calva is deliberately not treating the contents of strings as clojure code.

borkdude 2020-08-12T19:33:41.253Z

Consider this one:

(deftest datafy-test
  (testing "default implementation of datafy works"
    (is (= #{:public} (bb "(require '[clojure.datafy :as d]) (:flags (d/datafy Exception))"))))
  (testing "custom implementation of datafy works"
    (is (= {:number 1} (bb "
(require '[clojure.datafy :as d]
         '[clojure.core.protocols :as p])

(extend-type Number
  p/Datafiable
  (datafy [x]
    {:number x}))

(d/datafy 1)
"))))
  (testing "default implementation of nav works"
    (is (= #{:public} (bb "(require '[clojure.datafy :as d]) (:flags (d/datafy Exception))")))))

borkdude 2020-08-12T19:34:05.253200Z

It's not a major issue, just something that happens to work in emacs

pez 2020-08-12T19:36:18.253400Z

It could be made something that can be toggled. I really want it to behave like it does. But if I do have a case where I want help with lisp editing inside a string, that would be nice to toggle on.

borkdude 2020-08-12T19:37:05.253600Z

Surprisingly when I edit a file in emacs tramp via ssh, it's picked up in the Remote SSH plugin immediately, so missing features I can do in emacs, although it would be nice to have them all in one editor

borkdude 2020-08-12T19:37:33.253800Z

> But if I do have a case where I want help with lisp editing inside a string Well, I do that all the time in the tests for babashka and sci.

pez 2020-08-12T19:37:34.254Z

That's pretty awesome.

pez 2020-08-12T19:38:33.254200Z

(The emacs thing, not that you don't get help from Calva with your usecase πŸ˜„)

borkdude 2020-08-12T19:39:45.254400Z

Every time I press enter, the indentation is fucked.

borkdude 2020-08-12T19:41:16.254800Z

I see, it wants to indent the entire string according to the first quote's indentation. This is not what emacs does, so now I'm stuck between two different modes ;)

pez 2020-08-12T19:46:34.255Z

Could it be something that cljfmt can be configured to do differently?

pez 2020-08-12T19:47:19.255200Z

It looks super funky in your gif there. Might be a bug in Calva as well.

borkdude 2020-08-12T20:08:31.255400Z

Overall, so far so good! Thanks for the amazing Calva.

❀️ 1
bringe 2020-08-12T22:22:49.256200Z

A new vsix for the repl history feature: https://7515-125431277-gh.circle-artifacts.com/0/tmp/artifacts/calva-2.0.120-fix-740-allow-default-esc-keybind-feature-add-repl-history-158338ca.vsix Please give it a whirl.

🀘 4
Maksim Glebov 2020-08-13T07:48:01.256800Z

Works nice for me πŸ‘