Fork me on GitHub
#lsp
<
2022-06-02
>
dchelimsky13:06:29

I’m seeing intermittent unresolved-symbol warnings (VS Code w/ Calva + LSP) like this, and I’m not clear how to get rid of them.

dchelimsky13:06:41

Related: what do I need to do to see changes to .clj-kondo/config.edn reflected in Calva?

dchelimsky13:06:58

(short of closing and reloading the project)

ericdallo14:06:15

Try removing .clj-kondo/.cache and reload project to see if that unresolved is fixed

dchelimsky15:06:52

I did that and even closed and reopened VSCode, and it’s still there.

ericdallo15:06:54

Hum, I'm not aware of any issue like that, is there a repro project I can try?

dchelimsky15:06:23

I’ll hit you up in Nubank slack - it’s an internal project there.

dchelimsky15:06:07

One interesting thing: I’m seeing a mix of inline-def errors as well

ericdallo15:06:27

Hum, bigdec is from Clojure 1.11 right? there is a chance to be some kind of wrong clojure on classpath that clojure-lsp is passing to kondo

dchelimsky15:06:15

Possibly, but I’m also getting it for decimal? in another spot, and now I’m seeing an inline-def error where I was getting the unresolved-symbol error for decimal before ¯\(ツ)/¯.

dchelimsky15:06:55

spec.gen is clojure.spec.gen.alpha , which references functions from clojure.test.check.generators. I wonder if that’s related.

👍 1
ericdallo15:06:18

Alright, I'm getting the same for decimal? on emacs and the inline-def thing, let me debug it a little bit

ericdallo15:06:59

yeah, the fmap is telling kondo to use clojure.core/def on clj-kondo/config.edn

ericdallo15:06:39

for the inline-def the proper fix is to change the kondo config to:

{:lint-as {clojure.spec.gen.alpha/fmap clj-kondo.lint-as/def-catch-all}}

dchelimsky15:06:57

Why have that at all, then?

dchelimsky16:06:49

This is interesting. If I remove that config entirely, then I get unresolved-symbol for any x in (spec.gen/fmap x). Configuring clojure.spec.gen.alpha/fmap and clojure.spec.gen.alpha/gen-for-pred to lint-as clj-kondo.lint-as/def-catch-all solves for decimal as well.

ericdallo16:06:53

It'd be nice if kondo have support for that built-in, but clojure.spec.gen.alpha/fmap defines a var it seems

dchelimsky16:06:26

Same for many functions in that namespace.

ericdallo16:06:36

yeah, but AFAICS gen-for-pred doesn't defines a var, it receives a pred, so that decimal? from clojure.core should work without issues

ericdallo16:06:17

oh, I think I got it

ericdallo16:06:02

decimal? will only work for clj files, since this is a cljc file, kondo is complaining from the cljs side

ericdallo16:06:27

if you wrap it in a clj reader conditional the lint issue is fixed, not sure is the best fix tho

borkdude18:06:11

Feel free to post issues about this in the clj-kondo Github repo

borkdude19:06:38

I thought most of these spec/gen vars were covered out of the box with clj-kondo, but maybe not. So please do follow up