Fork me on GitHub
#calva
<
2024-02-13
>
yuhan15:02:34

What's the preferred beginner-friendly way of getting clj-kondo to lint files in a Getting Started / standalone REPL? As far as I can tell, it's only possible to start a clojure-lsp server in a pre-existing project folder

pez18:02:29

Hi! This is unsolved territory. The solution may be to add an option for creating a proper getting started project. Which is on my todo since a while for other reasons too.

yuhan21:02:09

Got it - that seems unfortunate as I've found clj-kondo to be especially helpful in pointing out and localizing the sorts of common syntax errors that beginners tend to make (eg. extra/missing parens, calling numbers as functions) - also the sort of thing which tend to produce confusing error messages when evaluated in the REPL. Really appreciate all the effort you've put into making the beginner experience as friendly and frictionless as possible, this seems like an area where some relatively simple fix would have a large impact :) After all one clj-kondo can be used as a purely standalone CLI tool that takes stdin with no concept of project folders or files, even though that might not expose 100% of its more advanced linting features.

pez21:02:01

To make the tutorial more complete it would be nice if it helped with showing a basic project structure. Then it could be a basis for someone’s first project. If we solve this, linting will be enabled out of the box.

yuhan21:02:17

I found a workaround for now by installing the standalone clj-kondo extension However Calva doesn't seem to like it and keeps displaying a popup warning of "duplicate linting reports".

yuhan21:02:08

I do think the "one-click" nature of the standalone REPLs is great for beginners who are just starting out learning the language concepts and syntax and don't need the additional cognitive load of learning about build tools and project folder structure. Enforcing a "create your first project" workflow from the very start just to get squiggly error lines seems like a step backwards, especially as the standalone extension shows it can be done without one

yuhan21:02:16

https://github.com/clj-kondo/clj-kondo.lsp is implemented as its own LSP server after all, perhaps Calva can use it as a fallback when the full clojure-lsp is not available? (not entirely familiar how this stuff works under the hood)

Jack Arrington23:02:26

I've upgraded to the latest Calva version and the autoformatter is doing weird stuff to my indentation, like changing

(fn [a b]
  (+ a b))
to
(fn [a b]
    (+ a b))
Any ideas what's wrong? This is driving me a bit crazy 🙂. Running v2.0.412

Jack Arrington23:02:59

Ah, searched in this channel and found the answer. For anyone having a similar problem: there was a breaking change in a recent version, and if your project has a .cljfmt.edn file, change indents -> extra-indents. https://calva.io/formatting/#indentation-rules

👍 1
seancorfield02:02:16

You must have been on a fairly old version? It feels like that changed "ages ago" (although I can't remember when)...

seancorfield02:02:39

(looks like mid-August 2023 when it changed... feels longer ago than that... time is an illusion! 🙂 )

pez03:02:12

I recall it quite well as I was pretty stressed up by the incident and it took me a while to figure out what to do about it. 😀

Jack Arrington20:02:27

Yeah, I was running the old version for a while...I recall I rolled it back because something broke when it upgraded (probably this) and I didn't want to deal with figuring it out right then. I was finally prompted to re-upgrade yesterday due to unrelated issues

fabrao23:02:46

Hello, is that normal the clojure-lsp take 4 minutes to load?

ericdallo01:02:17

The first time the server starts it needs to analyze the whole classpath so it's expect to take more time than subsequent starts, it depends on the size of the project, the amount of java and clojure deps.