Fork me on GitHub

There is a new way of running clj-kondo in IntelliJ which also works with the community edition:

clj-kondo 48

The LSP workflow doesn't require saving a file before running the linter on it, right? Would it be possible to run the LSP server via clj just so that I can add the RELEASE version to my user's deps.edn and stop worrying about the latest version?


@U2FRKM4TW good idea. Can you try with:

/usr/local/bin/clojure -Sdeps '{:deps {clj-kondo/lsp-server {:mvn/version "RELEASE"} clj-kondo {:mvn/version "RELEASE"}}}' -Sforce -m clj-kondo.lsp-server.main


as the command


(I think you need -Sforce else to checking of the latest release)


If that works for you, I'll add it to the README


Seems to work, but I had to increase the init timeout to a minute. Otherwise, I was getting

LanguageServer for definition
 rawCommand : /usr/local/bin/clojure -Sdeps '{:deps {clj-kondo/lsp-server {:mvn/version "RELEASE"} clj-kondo {:mvn/version "RELEASE"}}}' -Sforce -m clj-kondo.lsp-server.main
not initialized after 10s
Check settings
So, I'm not sure about the -Sforce flag. I think with RELEASE, clojure still checks for the latest version. Although, even if you don't specify the flag, the timeout will still probably happen when a new version of clj-kondo is released. Maybe it's worth mentioning the timeout and how to increase it. Another small thing - the guide says the path to the relevant settings section is just at Preferences / Language Server Protocol / Server definitions. The actual path, as given by IDEA itself, is File | Settings | Languages & Frameworks | Language Server Protocol | Server Definition (you can copy it via the context menu of the breadcrumbs section of the settings window).


Are you on Windows?


That might be a difference between mac and linux


Hmm, yeah - didn't realize that.


So you don't have the Languages & Frameworks part?


The uberjarred version has faster startup. Can you confirm that by trying it?


Oh yeah, it's definitely faster.


oh yes, I do. I will correct it.


ok, then I think that will still be the recommended way


but if you make a bash script that downloads the latest one and just replaces the existing by the same name, then you should have what you want


There are pros and cons to each way of setting this up, I guess. One gives faster startup, although it happens only once at IDEA startup; the other is able to download the latest version for you but requires an additional tuning of the init timeout value.


Regarding the script - well, if download takes a long time, it will be the same issue.


clj is slow only when it needs to recompute the classpath. Without the -Sforce flag, the timeout doesn't happen.


yes, but the cache is based on a hash of the deps.edn file I think


I already had a caching issue when using RELEASE


that's why you need -Sforce to make it work reliably


officially RELEASE isn't even supported anymore by a future version of maven


Huh, interesting. I'll keep an eye on it then. Because I'm almost certain that I've seen it download a new version all by itself when I didn't change the deps file.


The absence of RELEASE in Maven isn't really relevant for tools.deps because, I think, it doesn't use Maven. RELEASE can just be a spepcial value for the :mvn/version key. But that's a topic for a different discussion. 🙂


yes, but the cache depends on the contents of the deps.edn file


and RELEASE is just a constant string


anyway, feel free to use it with -Sforce, I just added it because I did have a caching problem just now when I came up with this solution

👍 4

Ah, almost forgot to say - thank you for making this workflow possible. Using the file watcher was creating just too much churning.


I just noticed that this folder got created:

├── conf
│   └── clojure.json
└── log
    ├── clojure_err_20191202.log
    └── clojure_out_20191202.log
The JSON file is empty. I couldn't find any reference to it in the source code of clj-kondo. Where does it come from? Can I safely add the whole folder to gitignore?


I think that is created by the LSP Support plugin.


I saw it too on my machine


maybe you can find something about it in their docs


I added it to .gitignore


Thanks! Yeah, they explicitly say that they create the lsp folder in the project's root.


Just to correct myself - turns out, the LSP server shuts down each time you close all relevant files, not when you exit IDEA. In this situation, having a high init time is indeed much more detrimental.


I think so too.


Wrote a little something about starting with Clojure Text Editors and how one might choose between all the options available:

👍 28
👀 4

Thoughts are very welcome 🙂


Nice one, nuanced. Emacs user here, but I celebrate diversity of choices, particularly to accomodate people coming from different backgrounds. As a random thought, I'd love for people to champion IDE-agnostic tooling. I often see people asking "how do I format|refactor|grep in $editor", when a better approach would be "how to x from the REPL" is perfectly invokable from the repl for example, and yet probably 90% of its userbase are emacs users.

💯 4
👏 4

100% agreed @U45T93RA6! I think building a culture of education and understanding goes a long way to getting to your point 🙂


Exactly :) More broadly, Clojure / Lisps have ways that are deeply different from practically all other mainstream languages. So ones sees the frequent mistake of people doing clj software engineering the same exact way they would in Ruby, or Java... That's pretty wrong, but at the same time one ought to demonstrate some patience and empathy.


That’s a brilliant domain name


@U45T93RA6 one of the things I think is missing is documentation. If we could document these features better, it would probably be easier for people to invoke then from the REPL, and also easier to integrate on editor's plug-ins too

👍 8

Just published Clover. It is a very experimental package for Socket REPLs on VSCode, based on the same machinery that powers Chlorine (for Atom):

💯 24
👍 20

Very cool! I must try it of course. Do you know how compatible the extension is with Calva? I’m thinking since there is a lot of general Clojure editing things in Calva, it would be nice if Clover users could benefit from them. I’ll give Clover some spins and see what I find.


I didn't check this compatibility, but it should work fine. Clover does not have any editing, so it would really be nice to benefit from it 🙂