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
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).
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
Also going to put a note in the output greeting about the history commands
I think we can detect cursor position and update a when
context in a selectionChanged
observer/watcher.
I might convert ... https://twitter.com/borkdude/status/1293527889690988544
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!
Sounds a bit like a habit you could challenge is using the repl prompt. π
Iβm a bit uncertain what you mean by REPL prompt π
You mean in the old REPL window?
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
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
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
How "open source" is VSCode?
My understanding is that the editor itself is open source but extensions for remote editing, WSL, Docker, etc., are proprietary.
Why would they make the remote editing plugin closed source?
thanks
Does clj::proj.core
mean: clojure, proj.core namespace? In CLJS you would get cljs::proj.core
?
Can you change the keybinding of forward slurp? I'd like to keep my mission control keybindings
Oh I see, that's a VSCode thing, not Calva per se.. duh. Sorry, new to this :)
Awesome, I now set it to what I'm used to in emacs :) ctrl-)
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.
Now I hope the SSH remote plugin will be free and around forever (open source fears)
Ajajaj... you can't connect to more REPLs?
There is also Theia, which I think might help in keeping MS taking the right decisions. π
At work I have a multi-repo where I need to be connected to two Clojure REPLs sometimes
I guess in that I'd just open two Windows?
βAjajajβ sounds oddly Swedish. Dutch? π Anyway, yes, there is https://github.com/BetterThanTomorrow/calva/issues/76
We also say it in Dutch ;)
Yeah, two windows. This is written by someone who doesnβt really understand the multirepo concept, but anyway: https://calva.io/workspace-layouts/
For me the most pressing need for one more REPL connection is that I want a babashka REPL always handy. π
:-D
Calva doesn't have sort namespaces (like Emacs clojure-mode
: clojure-sort-ns
)?
No. That would be nice. I think @slack1038 had it a branch there a long while ago...
> ctrl+shift+alt+up Select Backward Down Sexp > ctrl+shift+alt+down Select Forward Up Sexp makes sense right?
Is it possible to make paredit also work in strings?
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.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 π
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.
Does Calva have completions when connected to an nREPL server? It seems that it doesn't work?
It should if cider-nrepl is loaded as a dep in that repl
Ah.
That might be the problem, I connected to my own REPL. Thanks
Welcome!
I think I have screwed up a couple of default keybindings. Is there a way to restore them? ;)
I guess i can look them up here: https://github.com/BetterThanTomorrow/calva/blob/db449d690e8032c4bfedc22c4fc54c344c5a95e9/package.json#L1067
Doesn't the VS Code GUI for shortcuts have a button for resetting to defaults?
I haven't noticed it
Oh I guess when you right click
I'm such a VSCode n00b ;)
But guess what. I helped out someone at an online meetup tonight what was trying to evaluate something in the Calva output window.
I told him: do it from the buffer, ctrl+enter. And it worked. Haha.
So awesome!
The output window should work the same, though. alt+enter
and ctrl+enter
. If it didn't, then there is a bug somewhere.
I think he wasn't used to a recent change or something
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.
And clojure-sort-ns
The new repl was surprisingly disruptive for many.
What do you miss about structural editing in strings?
https://clojurians.slack.com/archives/CBE668G4R/p1597254004244600
I tend to edit code samples in strings for sci/babashka tests
Also the indentation is way off in code that's in strings
I see. Calva is deliberately not treating the contents of strings as clojure code.
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))")))))
It's not a major issue, just something that happens to work in emacs
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.
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
> 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.
That's pretty awesome.
(The emacs thing, not that you don't get help from Calva with your usecase π)
Every time I press enter, the indentation is fucked.
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 ;)
Could it be something that cljfmt can be configured to do differently?
It looks super funky in your gif there. Might be a bug in Calva as well.
Overall, so far so good! Thanks for the amazing Calva.
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.
Works nice for me π