Fork me on GitHub
#calva
<
2022-10-28
>
Alexander Kouznetsov00:10:14

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.

bringe02:10:27

What command are you running?

bringe02:10:42

If I run “Go to Symbol in Editor…” I see both the declaration and definition in the menu.

Alexander Kouznetsov15:10:41

Oh, you’re right! I never noticed that there is more than one. Do we need the declare one, though?

bringe20:10:04

Some people may want to go to the declaration :man-shrugging:

Benjamin17:10:12

jo how do I jack in deps.edn with additional :dev alias?

pez20:10:47

Hi! Can you elaborate a bit, what do you mean ”additional :dev alias”?

Benjamin08:10:52

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

pez10:10:19

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.

pez10:10:49

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/

Benjamin12:10:04

you are totally right I somehow missed this part when I tried. Cheers

🙏 1
Kari Marttila18:10:55

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?

pez18:10:53

I have had a similar issue, which I posted about in #C03DPCLCV9N . It’s still a mystery to me.

Kari Marttila18:10:53

Ok. No problem. There are a few rough edges but we keep on rocking with Calva!

Kari Marttila19:10:11

The keyboard shortcut is a good workaround for now.

pez19:10:40

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.

pez19:10:58

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+,",
    },

Kari Marttila19:10:24

Aah, thanks! I do that! 🙂

pez19:10:23

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+,",
    },

Kari Marttila20:10:42

Ok, I try that one later. The first solution works like charm. 🙂

pez20:10:33

The last one there is a bit more versatile.

pez20:10:02

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.

👍 1
☺️ 1
❤️ 1
calva 1
seancorfield20:10:29

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 🙂

pez20:10:44

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?

seancorfield20:10:30

No commits for nearly 3 years, except for dependabot updates (and no releases).

seancorfield20:10:58

But calling it "Clojure" and using the official logo is definitely not OK.

pez21:10:39

It gets very confusing, for sure.

seancorfield23:11:58

Andrey has updated clojureVSCode with a deprecation notice that points users to Calva:

🎉 4
clojure-spin 3
pez07:11:06

Oh, that's great!

pez07:11:33

Interesting/not so great that it still wins the SEO battle. 😃

1
thomas08:11:04

that might take a bit of time to filter through?

pez12:11:05

Do you know what the blue icon on the Calva symbol is about, @U04V70XH6? Never seen that one, I think...

Robert Wood15:11:11

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.)

🙏 1
stantheman16:11:00

Yes in my case it means it installed on the WSL: kali-linux rather than windows

pez17:11:48

Ah, thanks!

seancorfield17:11:06

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)

pez17:11:05

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

pez17:11:06

Clojure Code would be nice to see deprecated. It stopped working many years ago.

seancorfield18:11:55

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.

Kari Marttila20:10:06

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?

pez20:10:08

It's a Paredit issue. Kill Right should do the right thing. Please file an issue.

Kari Marttila20:10:22

Ok. Nice if I can help this way. Calva is a great tool and becoming even better. 🙂

Kari Marttila20:10:07

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.