Fork me on GitHub
#clj-kondo
<
2021-12-09
>
joost-diepenmaat09:12:04

I just filed a PR but one of the tests on CI fails and I’m not sure if it’s my code or something unrelated. https://app.circleci.com/pipelines/github/clj-kondo/clj-kondo/4076/workflows/1aca8e2a-61cc-4e40-951e-5b8380f42b9d/jobs/16417

joost-diepenmaat09:12:29

Tests run all find locally when doing script/test

borkdude09:12:34

It seems to be unrelated. Thanks, I'll take a look hopefully soon

joost-diepenmaat09:12:42

Ok, if it looks related I’ll take another look. Now off to do work that pays the bills 🙂

Roman Liutikov13:12:40

👋 What's the debugging strategy when running linters through LSP jar? I have a linter that works via CLI but warnings are not appearing in Cursive. I guess clj-kondo should be storing logs somewhere?

borkdude13:12:11

Are you using clj-kondo with clojure-lsp in Cursive or otherwise?

Roman Liutikov13:12:42

@borkdude Hey, no clojure-lsp, but kondo's LSP JAR

borkdude13:12:41

ok, I see. are you using the same version on the command line and LSP jar?

Roman Liutikov13:12:55

Thanks for creating the library btw 🙏 I'm working on linters for React hooks at Pitch. No promises, but will try to publish the linter when it's done and tested.

👍 2
Roman Liutikov13:12:12

> ok, I see. are you using the same version on the command line and LSP jar? uh, good question, let me check

Roman Liutikov13:12:52

alright, now I'm running both LSP and CLI of the same version, CLI works, LSP doesn't 😞 is there a way to get into logs?

borkdude13:12:39

I'm not sure if it logs anything interesting, but the source is here: https://github.com/clj-kondo/clj-kondo.lsp You can build the uberjar yourself and stick some logging in there

borkdude13:12:59

If you run bb tasks with babashka, you can see all tasks that are possible in this project

borkdude13:12:40

The one you want to have is bb lsp-jar

👍 1
Roman Liutikov13:12:03

btw, I'd love to have all predicates for all clj-rewrite token types (`vector-node?` etc) to be exposed in SCI env when running hooks. Doesn't seem like there's a way to extend SCI config, would you accept a PR for that? (to include more predicates)

borkdude13:12:46

yes, let's add them one by one though, because not all of them are obvious

fist-bump 1
Roman Liutikov13:12:53

This is my ducky workaround for now 😄 (= (str (type f)) "class clj_kondo.impl.rewrite_clj.node.fn.FnNode")

Roman Liutikov13:12:14

quick feedback: :__dangerously-allow-string-hooks__ option is great when developing linters in REPL

borkdude13:12:18

yes, this is what I added it for

borkdude13:12:22

also for tests

Roman Liutikov13:12:30

I've also tried writing hooks in a separate file first, but seems like kondo is not picking up changes, perhaps caching?

borkdude13:12:22

oh right, yes, it re-uses the SCI context and if you already loaded the hooks, it won't reload them again.

👌 1
borkdude13:12:00

if you run (require '[clj-kondo.impl.hooks] :reload) then it probably will

💡 1
Roman Liutikov15:12:38

ok, I got it working, but... 😄api/reg-finding! seem to be ignoring :end-col and :end-row? • warning/error messages are not showing up in a popover when hovering over underlined code (this is working fine with clojure-lsp, but not with clj-kondo lsp 😞)

borkdude15:12:47

🎉 how are you calling reg-finding? can you verify if the end-col and end-row are there to begin with?

👀 1
borkdude15:12:10

about the popover - I'm not sure what clj-kondo.lsp and clojure-lsp are doing differently - is this something you would know about @UKFSJSM38?

ericdallo15:12:39

not really, I can't see anything clojure-lsp is doing diferently about that :thinking_face:

borkdude15:12:28

perhaps it has to do with end-row / end-col then

ericdallo15:12:07

hum, makes sense as the warning needs a end-col and end-row on client side

Roman Liutikov15:12:40

> perhaps it has to do with end-row / end-col then what interesting is that the message is not showing up for default linters as well

Roman Liutikov15:12:19

this one seem to include end row/col

borkdude15:12:45

maybe clj-kondo.lsp needs to upgrade the lsp library? it's pretty old probably

borkdude15:12:57

but this intellij lsp plugin is also pretty old

ericdallo16:12:27

yeah, my guess is the intellij plugin

borkdude16:12:59

but he uses the same lsp intellij plugin for clojure-lsp?

ericdallo16:12:14

oh and does it work for clojure-lsp?

Roman Liutikov16:12:43

nah it doesn't, I've double checked

Roman Liutikov16:12:57

no message in a popover in both kondo lsp and clojure-lsp

ericdallo16:12:05

yeah, so it sounds like a intellij plugin issues indeed

ericdallo16:12:26

Come to emacs 😛 Just kidding, unfortunately the intellij lsp plugin is not actively mainted as much as other lsp editors plugins :/

ericdallo16:12:13

last commit was from apr/2020

Roman Liutikov16:12:52

hehe, I guess I'll stop writing those linters then

borkdude16:12:42

@U0FR82FU1 you're still writing it for those who use clj-kondo on the command line or in other editors ;)

ericdallo16:12:43

Although, clj-kondo is used a lot, for example on clojure-lsp that is used on editors like VScode/emacs/vim

Roman Liutikov16:12:01

Clojure community really needs more hands to provide a good dev experience

borkdude16:12:35

IntelliJ just needs better LSP support

Roman Liutikov16:12:56

lots of Pitchers are using Cursive, but yeah, could be useful for others and CI as well

ericdallo16:12:01

yeah, besides that, IMO the tools overall are really good for clojure

borkdude16:12:20

I've also asked @U0567Q30W if he was interested in adding clj-kondo to Cursive, and he was open to that. You can bring this to his attention again.

ericdallo16:12:47

it'd be really good @borkdude for a common lib and configuration 🙏

borkdude16:12:49

And ask in #cursive how other Cursive users are using clj-kondo, there are a few of them

1
ericdallo16:12:27

at least at nubank, the people who use cursive doesn't just run the lint on the command line and fix it manually :(

ericdallo16:12:58

and for complex macros (that we have clj-kondo config) they just live with that not working on cursive 🥲

ericdallo16:12:28

that's why Nubank is now recommending to new devs using editors with LSP support :)

Roman Liutikov16:12:00

gluing everything together is hard

borkdude16:12:46

perhaps forking the lsp plugin could work - but I can imagine that appears to be a daunting task

borkdude16:12:47

or making a bespoke intellij plugin for clj-kondo - but I really hope that @U0567Q30W will just add clj-kondo support to Cursive

borkdude16:12:12

There is an open source IntelliJ plugin called Clojure-Kit

borkdude16:12:26

which could maybe be forked and hacked upon to get diagnostics

borkdude16:12:59

@U0FR82FU1 another thing btw. does CIDER work with intellij - i.e. do CIDER warnings get propagated to intellij as diagnostics?

borkdude16:12:10

then clj-kondo could maybe work as a cider plugin-ish or so

borkdude16:12:46

There must be a light weight way to get clj-kondo working in that environment

Roman Liutikov16:12:14

No idea :woman-shrugging:

borkdude16:12:39

you don't use CIDER with intellij?

borkdude16:12:14

the problem is, I could make an intellij plugin, but I never use it, so it wouldn't be as maintained as when I would use it

Roman Liutikov16:12:16

no, I only use what Cursive provides out of the box, now trying with clj-kondo, but no luck so far

borkdude16:12:34

@U0FR82FU1 btw, you can also get clj-kondo running as a github action and it will print diagnostics in the code as feedback

borkdude16:12:50

so when you push to a branch, this will still help you get feedback

Roman Liutikov16:12:02

we do use it to lint PRs, working great 👌

ericdallo16:12:00

I think @U5B8QSSC9 configured clojure-lsp on intellij, maybe ask if he got the same issue with the popup

ericdallo16:12:10

He works on Pitch as well :p

borkdude16:12:04

@U0522TWDA I think also uses clj-kondo + Cursive...

Roman Liutikov16:12:20

trying with file watcher, seems like it works for others

Roman Liutikov16:12:36

@UKFSJSM38 Otto is running it via lsp jar as well 🙂

👍 1
Jakub Holý (HolyJak)16:12:22

I had some problem with using clj-kondo directly via a file watcher, which I don't remember. And I have given up on Clojure-lsp because the IntelliJ LSP plugin somehow sends many unfounded "file changed" messages in a short time (on my largish project) , which kills my cpu. So I started using kondo via a pre-commit hook.

ericdallo16:12:12

@U0522TWDA clojure-lsp is ATM ignoring those messages so maybe give it another try makes sense?

Jakub Holý (HolyJak)16:12:37

Ah, awesome, thanks! Will try!

Roman Liutikov16:12:36

doesn't work via file watchers at all, lol

Roman Liutikov16:12:04

prints something about FILE_PATH is undefined, but ignoring that var doesn't make any difference

Roman Liutikov16:12:29

although I do see linting output in IDE's console

Roman Liutikov16:12:51

that's what I've followed

borkdude17:12:06

@U06S1EJPL has edited that section a few times - perhaps he knows stuff?

borkdude21:12:13

@U0FR82FU1 I've talked to @UQTHDKJ8J who is the author of a IntelliJ plugin called "Clj Stuff" and it will soon support clj-kondo

ericdallo21:12:44

That's really good news!