Fork me on GitHub
#calva
<
2021-04-02
>
yuhan02:04:14

I just looked at Calva for the first time in a while, it's amazing how many improvements were made in the meantime! One somewhat distracting "new" behaviour I noticed though - the "quick fixes" lightbulb is being triggered for basically everywhere, suggesting that I change collections to vectors/maps or cycle the privacy of defs. Where is this coming from and can I disable it on a per-rule basis? Some refactorings like "move to let" are useful but others just create unnecessary noise and clutter on a default config.

ericdallo02:04:42

Those are code actions that come from clojure-lsp, they are suggestions and there is no opt-out ATM. it's pretty common to return all available code actions and user decide if use or not, if you want important code actions only, VSCode will show a different color for the ones clojure-lsp qualify as important for that code like add missing require

ericdallo02:04:12

One thing I notice though @U9A1RLFNV is that calva is suggesting the resolve macro as even if does not has support yet

ericdallo02:04:29

You may want to ignore that action or implement it maybe

yuhan04:04:52

I see, thanks for the info! I just found it a minor annoyance more than anything, like a notification counter that won't go away.

yuhan04:04:43

Sometimes the lightbulb also obscures the actual text, although that's probably a VSCode issue rather than Calva's

pez07:04:47

You can disable the lightbulb, @UCPS050BV. That’s what I do. The quick fix action is available anyway (`cmd+.` on mac).

☝️ 3
👍 3
bringe20:04:22

Thanks for the heads up @ericdallo

👍 3
Luan17:04:03

Hey guys. It seems that although the jack-in command was working for me a few days ago, VSCode now tells me Ctrl + Alt + C, Ctrl + Alt + J is "not a command". Further probing reveals that the command does not appear in the command palette when searched for. I also found this thread where @pez dealt with the same (or a similar) thing some time ago so I thought he or another might recall the solution. https://github.com/BetterThanTomorrow/calva/issues/287 I tried installing the versions from 3 and 6 days ago to see if it had anything to do with the update, but no apparent difference. Worth making a help report, or maybe I'm missing something? Thanks – on the brighter side, loving this plug-in so far.

pez17:04:34

Are you in a Clojure project when attempting jack-in?

Luan17:04:38

Tried both with a Clojure project open and without one open; same result.

Luan17:04:43

Hang on . . . It was only the file that was open.

Luan17:04:52

With the folder open, seems to work.

Luan17:04:12

Thank you!

pez17:04:08

Yeah, needs a folder. That’s where the Standalone REPL comes in. Glad you got it working!

cjsauer17:04:27

Is the shadow-cljs + deps.edn jack-in option known to be broken? I can’t quite get it working. No error messages, no logs, it just hangs at nREPL server started on port… and the output REPL buffer never drops into a prompt. My http server needs to be started by running (go) in the clj repl, but I can’t get that far, which means I can never load my cljs code in the browser to get that runtime connected either. :thinking_face:

pez17:04:26

It could be broken… Have seen a bit of trouble with it. Yesterday there was someone, (@U6JS7B99S?) who posted about a setup using a deps.edn alias instead. I will have a look at deps.edn + shaodw-cljs tomorrow to see if it is the implementation or the documentation that is broken.

cjsauer17:04:53

I just got it working! I used the custom :watch alias in deps.edn documented in this issue here: https://github.com/BetterThanTomorrow/calva/issues/1032

cjsauer17:04:21

I’m also using datomic dev-local like the user in this issue, so that might have been part of it? Not sure.

cjsauer17:04:08

I also restarted VS Code and that seemed to shake something loose. There was an update at the exact same moment, so it might have just been terrible timing 🙂

cjsauer17:04:22

Anyway, thank you for Calva 🙏 , it’s a really great tool

pez17:04:05

Glad it is working! If you see how the http://calva.io documentation could be improved, please file an issue and/or PR.

👍 3
alpox18:04:48

I did the same thing due to likely the same issue ;)

seancorfield20:04:57

Given the following snippet of code:

(defmulti foo :bar)
(defmethod foo :test
  [{:keys [a b] :or {a 1 b 2}}]
  (let [q (* 10 (dec a))]
    (+ b q)))
I’m seeing unused default for binding a (and b) here. The warning doesn’t show up in the latest clj-kondo when run standalone. @borkdude confirmed he sees it in Calva and that it doesn’t appear in standalone clj-kondo (from the command-line).

seancorfield20:04:51

i.e., the warnings are in {a 1 b 2} not on the keys part — what does this warning even mean? “unused default”

borkdude20:04:31

Funnily enough the warning goes away when you change it to defn:

(defn foo
  [{:keys [a b] :or {a 1 b 2}}]
  (let [q (* 10 (dec a))]
    (+ b q)))

borkdude20:04:36

@seancorfield unused default means that that code doesn't have any meaning because the binding for which you introduced the default was never used

borkdude20:04:03

instead of "unused binding" it says that, because you're not really introducing a new binding there

borkdude20:04:38

@pez I think it would be useful if Calva printed the contents of CLJ_KONDO_VERSION at startup (this is available in the classpath) so people know what they are using

bringe20:04:31

Startup of Calva itself, right? We currently have the "LSP Server Info" command which shows the kondo version being used by lsp. Do you mean this?

borkdude20:04:49

oh I didn't know this, thanks

👍 3
borkdude20:04:40

@seancorfield you can also try enabling the clj-kondo standalone vscode plugin and disable calva linting, to see if that makes a difference

borkdude20:04:40

@seancorfield see #lsp, it seems something specific with this

seancorfield20:04:04

Joined. Thanks.

borkdude21:04:23

I heard it's possible to update clojure-lsp separately from calva, how does one do this? I don't find the info here: https://calva.io/clojure-lsp/#troubleshooting

borkdude21:04:36

Oh, I see. In the extension settings

borkdude21:04:08

@seancorfield Tomorrow when @ericdallo creates a new lsp version you can upgrade it here:

👍 3
bringe21:04:48

Ah we need to add that setting to the docs. Thanks

seancorfield22:04:18

Oh wow, good to know! Thank you!

bringe01:04:45

Adding it to docs would probably be good. Doesn't hurt at least. :man-shrugging:

pez06:04:04

Totally agree.