Fork me on GitHub
#vim
<
2023-04-04
>
James Amberger17:04:37

I'm using ALE for linting in vim and it complains about macros from imported libraries, eg:

;;; defnc is from helix
(defnc my-component [{:keys [pdf-path]}] ; E: error: Unresolved symbol: my-component

2
rafaeldelboni16:04:30

What ALE uses as it's backend for linting, if it uses Kondo you can create this file: https://github.com/rafaeldelboni/helix-refx-reitit-example/blob/main/.clj-kondo/config.edn

James Amberger22:04:58

(yes, it's Kondo, and looking into it I find that it also looks for `joker' on one's path)

rafaeldelboni23:04:01

I searched a lil bit about it and I saw that you have options of those two sources, quite cool, the good part of using kondo, is that if you decide to go using lsp in the future you wont have any extra config to make it work 🙂

James Amberger23:04:40

yeah I am irrational about lsp

James Amberger23:04:55

my editor talking to the world every time I type something...

James Amberger23:04:23

I am glad that this is not yet required to have a great editor experience

rafaeldelboni23:04:49

But with LSP you don't need internet, is a local process, your computer starts a server that talks in a json protocol.

James Amberger23:04:21

I see... somehow I'd gotten the impression that the default was a public server

James Amberger23:04:54

is there anything more I have to do to get that hook working?

rafaeldelboni23:04:16

No, I think it's because the json protocol can lead to this, but it's local. The good part is that most of the editors know how to talk this protocol and the "server" is responsible to parser your code and return the editor requests, with cache and all that.

James Amberger23:04:16

It is still complaining of unresolved symbol when i use the defnc macro

rafaeldelboni23:04:44

No, double check if the file is in the same path root-your-project/.clj-kondo/config.edn

rafaeldelboni23:04:59

dunno if there is an extra for ALE check this file

James Amberger23:04:13

i put it in .config/clj-kondo, and also tried specifying it on the command line

James Amberger23:04:24

clj-kondo --config ~/.config/clj-kondo/config.edn --lint ./src/dev/fdny/lss/evds.cljs

rafaeldelboni23:04:38

you having problem with the defnc from helix or a macro wrapper you wrote over it?

James Amberger23:04:08

no, just straightforward use of defnc

rafaeldelboni23:04:17

this was downloaded automatically by kondo, in my first example I had to write a wrapper over defnc (as helix recomends) so I added that extra config

rafaeldelboni23:04:44

depending of your project structure it should download helix configs automatically

James Amberger23:04:59

I have a shadow-cljs project, nothing fancy about it

James Amberger23:04:11

let me see if I can coax clj-kondo into downloading something

rafaeldelboni23:04:22

clj-kondo --lint "$(clojure -Spath)" --copy-configs --skip-lint

rafaeldelboni23:04:35

in the root of your project should do the trick

rafaeldelboni23:04:54

you can delete that file you created that I sent you at first (sorry)

James Amberger23:04:50

do you usually commit the .clj-kondo dir?

rafaeldelboni23:04:40

(lsp downloads those for you automatically, just saying hahaha)

James Amberger23:04:51

ha I may look in to lsp

James Amberger23:04:16

I dunno, I ran your one-liner and my .clj-kondo remains empty

rafaeldelboni23:04:35

maybe folks in #CHY97NXE2 could help you with this one 🙂

James Amberger23:04:56

thanks for the chat; I'm reading the clj-kondo docs now

rafaeldelboni23:04:26

Yeah, feel free to ping me, I really like helix as well doing a lot of studies on it

James Amberger23:04:43

looks like I need to include clj-kondo in my deps.edn

James Amberger23:04:47

ok thanks I will

rafaeldelboni23:04:27

uhm interesting, I didn't knew about it

rafaeldelboni23:04:54

I would like to know if this will work

James Amberger23:04:52

clj-kondo --lint "$(npx shadow-cljs classpath)" --copy-configs --skip-lint --lang cljs

James Amberger23:04:08

so I needed to specify classpath from shadow-cljs