Fork me on GitHub
#calva
<
2022-04-26
>
awb9904:04:15

On guix os calva is not able to start static code analysis. I believe it is because guix does not have programs in /bin but rather in a uncommon location /gnu/store. Any ideas could fix that? Or at least see debug logs that show me the underlying issue. Thanks!

pez05:04:07

Hi! By default Calva downloads the clojure-lsp executable and runs it, so it is not looking for in some conventional directory. What error message do you get?

ericdallo11:04:09

Guix works similar to NixOS, I'm a nix user and as PEZ said, Calva should download the static linux binary for you which should work for Guix.

ericdallo11:04:47

@U0ETXRFEW do you know if calva downloads the Linux binary or the static linux binary? For Guix/NixOS and probably other Isso only the static one will work

pez12:04:45

Don't know, maybe @U9A1RLFNV knows. He's on Linux.

ericdallo12:04:11

Yep, it's not downloading the static one, I think it's a easy fix, just switch the linux to use the static one: https://github.com/BetterThanTomorrow/calva/blob/published/src/lsp/download.ts#L24

pez12:04:04

Thanks. Issue welcome!

bringe15:04:16

@U0ETXRFEW I’ve been on MacOS for some time now. Switched partly for work (iOS RN dev). @UKFSJSM38 The static one would work for all linux distros or just for the static distros?

ericdallo15:04:11

it should work for all linux

👍 1
bringe15:04:36

I’ll make the issue

👍 1
bringe15:04:24

@hoertlehner A workaround, until we fix that, is to download the static binary from the clojure-lsp releases and and set the path to it in your settings for Calva. https://calva.io/clojure-lsp/#using-a-custom-clojure-lsp-native-binary

bringe15:04:51

Once we update the code you might want to reset that setting so Calva goes back to downloading the latest version for your OS.

gratitude 1
awb9919:04:40

Thanks to everyone! I was successful with downloading clojure native static version and setting the calva clojure-lsp setting to: /home/florian/repo/clojure-quant/clojure-lsp

metal 3
clojure-lsp 3
bringe03:04:17

@hoertlehner I’ve made Calva download the static Linux binary for clojure-lsp if the host OS is Linux. If you could install this vsix and let me know if clojure-lsp downloads and starts successfully for you, that would be helpful. https://output.circle-artifacts.com/output/job/6c859cfc-da8b-437e-bb3b-f77835b5a783/artifacts/0/tmp/artifacts/calva-2.0.270-fix-downloaded-clojure-lsp-static-linux-e6c39d5c.vsix If anyone else who uses a non-static Linux distro could try this as well that would be great.

metal 1
Setzer2209:04:09

Hi! Is there a way to evaluate the current file with calva without going form by form?

pez09:04:32

Hello! There is a command Calva: Load Current Files and Dependencies. See also: https://calva.io/commands-top10/

👍 2
1
Setzer2209:04:22

thanks!

🙏 1
1
Daniel Jomphe21:04:41

Hi! Are you aware of a way to wrap a fn in such a way that Calva's tooltips will show the original fn's docstring?

pez21:04:40

Maybe it works with something like this?

(def ^{:doc (:doc (meta #'original-fn))} my-fn original-fn)
(Haven't tested. 😃 )

wow 1
Daniel Jomphe22:04:45

Yes, it does work (I tried many things like this last year without success), thanks a lot, I'll continue experimenting to make sure it works well with multiple arglists, etc!

Daniel Jomphe22:04:02

I see it's lost the arglists. Here's the original:

1
Daniel Jomphe22:04:45

Yeah, I'd need to copy not just the :doc obviously. 🙂

pez22:04:24

i wonder if that is possible... Maybe it is.

Daniel Jomphe22:04:37

I've had success manually:

pez22:04:11

Yeah, maybe because it is late here, but I had forgotten the args-list is there. Very cool. Neat with the prefix!

Daniel Jomphe22:04:28

Getting subjectively late for me too! 🙂 It's with a macro wrapper that I'm yet to succeed, now.

pez22:04:47

Maybe you can make a macro out of it? (def-special ..) 😃

rayat00:04:53

Cool stuff... unrelated, what font is that?

Daniel Jomphe20:04:21

This is Cascadia Code from Microsoft.

Daniel Jomphe20:04:39

Finally came back to this. Thanks a lot Peter! An intern-based solution suggested by Sean Corfield in the other thread worked. Observe the (defn wrap-fn solution works but Clj-Kondo underlines in red the produced var, obviously. Then, a lightweight (defmacro defwrapped wraps the call to make it understandable by clj-kondo. In this example, note it only allows to prefix and suffix docstrings.

Daniel Jomphe20:04:58

This current implementation allows us to give a new name to the wrapped function. Not sure if it's really a good idea. The most important next step is to weed out how to override the original fn's body/bodies.

Daniel Jomphe20:04:00

Here's Calva happy

pez20:04:37

So awesome! Can we look forward to a blog post about it?

Daniel Jomphe20:04:33

Wow! My last blog post is from 2009. Gotta think about it!

Daniel Jomphe20:04:54

Maybe a post on Clojureverse would be a sufficiently linkable artifact?

pez20:04:05

That's an excellent place to tell about this.

Daniel Jomphe18:04:12

Nothing yet exposed to the wrapper body, but some docstring-handling progress

bringe03:04:17

@hoertlehner I’ve made Calva download the static Linux binary for clojure-lsp if the host OS is Linux. If you could install this vsix and let me know if clojure-lsp downloads and starts successfully for you, that would be helpful. https://output.circle-artifacts.com/output/job/6c859cfc-da8b-437e-bb3b-f77835b5a783/artifacts/0/tmp/artifacts/calva-2.0.270-fix-downloaded-clojure-lsp-static-linux-e6c39d5c.vsix If anyone else who uses a non-static Linux distro could try this as well that would be great.

metal 1