This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-10-28
Channels
- # announcements (5)
- # babashka (7)
- # beginners (101)
- # biff (9)
- # calva (46)
- # cider (6)
- # clj-yaml (2)
- # cljsrn (13)
- # clojure (11)
- # clojure-europe (43)
- # clojure-nl (13)
- # clojure-norway (22)
- # clojurescript (20)
- # conjure (1)
- # cursive (7)
- # data-science (2)
- # datomic (26)
- # emacs (38)
- # graphql (27)
- # gratitude (5)
- # hoplon (8)
- # hugsql (22)
- # humbleui (2)
- # hyperfiddle (6)
- # introduce-yourself (8)
- # joyride (3)
- # lsp (79)
- # malli (6)
- # nbb (67)
- # portal (16)
- # rdf (27)
- # reagent (42)
- # releases (2)
- # remote-jobs (1)
- # shadow-cljs (36)
- # test-check (17)
- # tools-deps (1)
- # xtdb (15)
Can we skip declare
in Go To Symbol? I. e. if I have a code that declares certain vars, go to symbol would point at those declares and not on the actual definition.
Example:
(declare f) ; <-- Go to "f" symbols shows this line.
...
(defn f [] ...) ; <-- I want it to show this line instead.
If I run “Go to Symbol in Editor…” I see both the declaration and definition in the menu.
Oh, you’re right! I never noticed that there is more than one. Do we need the declare one, though?
I mean when starting the clojure process basically passing -M
:dev:alias1:alias2
. With cider I achieve this by setting cider-clojure-cli-aliases
. The use case is a .deps.edn project that has a :dev
alias that should be passed when I jack in with calva
Are you referring to the command Start a Project REPL and Connect (aka Jack-In)? It should find the aliases in your deps.edn file and prompt you for which ones you want to launch with. If it doesn't, then either there is something funny in that deps.edn, causing Calva to fail, or something is wrong in Calva.
Assuming that things are actually working and you want to skip that prompt during Jack-in, you can do so by using a custom repl jack-in/connect sequence. The setting is named calva.replConnectSequences
, and you would configure this particular thing with menuSelections.cljAliases
. See https://calva.io/connect-sequences/
I have the following snippet in my ~/.config/joyride/scripts/user_activate.cljs
:
;; Calva Paredit: Copy Sexp Forward
(defn copy-forward-sexp []
(p/do
(vscode/commands.executeCommand "paredit.selectForwardSexp")
(vscode/commands.executeCommand "editor.action.clipboardCopyAction")
(vscode/commands.executeCommand "cursorUndo")))
Usually this works just fine. But occasionally I get an error:
ERROR: Could not resolve symbol: copy-forward-sexp
{:type :sci/error, :line 1, :column 1, :message "Could not resolve symbol: copy-forward-sexp", :sci.impl/callstack #object[cljs.core.Volatile {:val ({:line 1, :column 1, :ns #object[U1 clojuredocs], :file nil})}], :file nil, :phase "analysis"}
And I have to run joyride.runUserScript
with args user_activate.cljs
, which I nowadays have as a keyboard shortcut since this is a bit annoying to do using the VSCode command palette.
{
"key": "ctrl+t ctrl+,",
"command": "joyride.runUserScript",
"args": "user_activate.cljs"
},
Am I doing something wrong? I.e. Why the joyride configuration seems to be "missing" every now and then?I have had a similar issue, which I posted about in #C03DPCLCV9N . It’s still a mystery to me.
Ok. No problem. There are a few rough edges but we keep on rocking with Calva!
The keyboard shortcut is a good workaround for now.
You can put that paredit command in a separate script and execute that from your keyboard shortcut. Makes more sense than executing user_activatte.cljs.
Or this shortcut:
{
"command": "joyride.runCode",
"args": "(p/do (vscode/commands.executeCommand \"paredit.selectForwardSexp\") (vscode/commands.executeCommand \"editor.action.clipboardCopyAction\") (vscode/commands.executeCommand \"cursorUndo\"))",
"key": "ctrl+t ctrl+,",
},
Aah, thanks! I do that! 🙂
Depending on where you place the cursor when executing the shortcut this might work too:
{
"command": "joyride.runCode",
"args": "(require '[\"$v0\" :as calva]) (vscode/env.clipboard.writeText (second (calva/ranges.currentForm)))",
"key": "ctrl+t ctrl+,",
},
Ok, I try that one later. The first solution works like charm. 🙂
The new (since some half year or so) VS Code product manager is so active and in contact with the extension authors. Asking for feedback, acting on feedback. And he is an excellent ambassador for extension authors towards the marketplace team. A few days ago I asked that Calva be marked as recommended for Clojure. Now I see this in VS Code Insiders. Sweet! And hopefully it could help more people avoid installing both that Clojure extension and Calva, something that is very common, and causes a lot of problems.
Nice! I opened an issue on the clojureVSCode
repo about maintenance and logo usage -- it really should not use the official Clojure logo: Rich has been pretty clear that only official projects should be using that! Hopefully, Andrey will take that as friendly advice and update his extension to make it look "less official" and perhaps add a note about the maintenance status of the extension and maybe even add a recommendation to use Calva instead 🙂
Cool. To my experience Andrey is very responsive. I had the impression that his extension is maintained and supported still, has that changed, you think?
No commits for nearly 3 years, except for dependabot updates (and no releases).
But calling it "Clojure" and using the official logo is definitely not OK.
Andrey has updated clojureVSCode
with a deprecation notice that points users to Calva:
Do you know what the blue icon on the Calva symbol is about, @U04V70XH6? Never seen that one, I think...
Perhaps indicating that it's installed on a remote development machine? It uses the same symbol as the indicator on the bottom left of VS code. (I see the same thing in marketplace.)
Yes in my case it means it installed on the WSL: kali-linux rather than windows
Yup, all my "remote" (WSL2) extensions have the blue "back and forth" icon. None of my local extensions have it. Re: the other Clojure extension -- I expect that will drop down the list now it is deprecated. Maybe I should open issues on several of the other extensions asking them not to use the official Clojure icon...? (Andrey removed it because I asked)
I've asked Nikita Prokopov (aka Tonsky) to deprecate Clojure Warrior, since Calva is since long hosting the services it provided (this is why Tonsky is listed as á major contributor to Calva on Github). He immediately acted on it: https://github.com/microsoft/vscode-discussions/discussions/1#discussioncomment-4117282
This is what I had posted in the issue on clojureVSCode
in case anyone wants to visit all those extension repos and open issues pointing out that they should not be using the official Clojure logo:
Did you get permission to use the logo? See https://groups.google.com/g/clojure/c/mc-JzjXspe0/m/ol17UfGrqbQJ for some discussion about that.
One more formatting (minor) issue. If I'm editing Clojure code and at some point I have done some modifications and I have a form like this: (`|` marks cursor):
(map inc (map inc
|(range 3)))
If I then backspace
I get this:
(map inc (map inc (range 3)))
... which is what I want.
But. If the cursor is here:
(map inc (map inc |
(range 3)))
... and I either delete
or I Calva Paredit: Kill/Delete Right
I get this:
(map inc (map inc (range 3)))
... which is definitely not what I want.
Is this a Calva formatting feature or can I do something about this?Ok. Nice if I can help this way. Calva is a great tool and becoming even better. 🙂
I have a good keyboard shortcut key for Calva Format: Format Current Form and trim space between forms
, so running that command in those cases is a good workaround for this minor issue, but I create the ticket.
Andrey has updated clojureVSCode
with a deprecation notice that points users to Calva: