Fork me on GitHub

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.


Tests run all find locally when doing script/test


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


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?


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


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?


I'm not sure if it logs anything interesting, but the source is here: You can build the uberjar yourself and stick some logging in there


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


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)


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


yes, this is what I added it for


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?


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

👌 1

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 😞)


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

👀 1

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?


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


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


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


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


but this intellij lsp plugin is also pretty old


yeah, my guess is the intellij plugin


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


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


yeah, so it sounds like a intellij plugin issues indeed


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


last commit was from apr/2020

Roman Liutikov16:12:52

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


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


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


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


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


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.


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


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


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


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


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

Roman Liutikov16:12:00

gluing everything together is hard


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


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


There is an open source IntelliJ plugin called Clojure-Kit


which could maybe be forked and hacked upon to get diagnostics


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


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


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

Roman Liutikov16:12:14

No idea :woman-shrugging:


you don't use CIDER with intellij?


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


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


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 👌


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


He works on Pitch as well :p


@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.


@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


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


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


That's really good news!