This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-12-01
Channels
- # adventofcode (30)
- # announcements (51)
- # aws (27)
- # babashka (1)
- # beginners (16)
- # calva (6)
- # cider (10)
- # clj-kondo (2)
- # clojure (94)
- # clojure-dev (27)
- # clojure-italy (1)
- # clojure-taiwan (1)
- # clojure-uk (5)
- # clojurescript (18)
- # clojutre (2)
- # cursive (14)
- # data-science (8)
- # emacs (2)
- # joker (5)
- # off-topic (3)
- # shadow-cljs (31)
- # sql (2)
- # vim (2)
- # yada (11)
There is a new way of running clj-kondo in IntelliJ which also works with the community edition: https://github.com/borkdude/clj-kondo/blob/master/doc/editor-integration.md#lsp-server

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
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).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.
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. 🙂
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
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:
lsp
├── 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?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.
Wrote a little something about starting with Clojure Text Editors and how one might choose between all the options available: https://betweentwoparens.com/clojure-text-editors
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" https://github.com/clojure-emacs/refactor-nrepl is perfectly invokable from the repl for example, and yet probably 90% of its userbase are emacs users.
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 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.
@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
Just published Clover. It is a very experimental package for Socket REPLs on VSCode, based on the same machinery that powers Chlorine (for Atom): https://marketplace.visualstudio.com/items?itemName=mauricioszabo.clover
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 🙂