Fork me on GitHub
#calva
<
2021-01-18
>
Stefan09:01:34

Could it be that the clj-kondo integration in clojure-lsp has broken the ability to configure clj-kondo? I have some rules in .clj-kondo/config.edn , which don’t seem to be picked up anymore. When I put them in .calva/.clj-kondo/config.edn they also don’t work…

borkdude09:01:52

I think tools using clj-kondo internally should respect .clj-kondo/config.edn since the editor isn't the only tool leveraging this config. Think CI jobs, other people in your team using other editors like emacs with only flycheck, etc.

pez10:01:19

Indeed. That’s the intended behaviour. Let’s see what @brandon.ringe can tell us about any difficulties with this.

👍 3
clyfe12:01:23

I would like it if paredit.selectCloseList would also select a top level form if cursor is at it's start (same for all *List ops). My misfit workflow where "Alt+D"=killToClipboard carries everything is mildly stunted by the lack thereof.

clyfe12:01:33

Another example: Ctrl+D (kill list) should be able to delete a top level form if in front of it.

pez12:01:16

A when context for this might be in place, it sounds like?

pez12:01:58

Generally I try to keep the paredit commands close to the primitives used internally in Calva, to make it easier for me to “think” with them. As primitives they need to be quite clean and not have branches if it can be avoided. So if we can solve this selectCloseList in a way that we don’t need to change the paredit command; that is preferable.

clyfe12:01:44

A !calva:inSexp flag would allow branching between selectCloseList & selectForwardSexp, the latter works top-level.

clyfe12:01:47

Me, I'm shooting for "use one thing all the time" rather than "mental gymnastics based on context", at least for now; I'm paredit newbie.

pez12:01:05

calva.isTopLevel, maybe?

👍 3
pez12:01:02

It’s made to be composable, so I’m opting for that. But if we can aid the actual composing with when clauses, I am all for it. 😃

Stefan15:01:19

I would also LOVE to have parinfer smart mode in VSCode. Ah well, can’t have it all 😉

pez15:01:33

The prompts and options?

bringe17:01:52

@stefan.van.den.oord @borkdude @pez Clj-kondo config in .clj-kondo/config.edn should work as usual. If it does not then there's an issue to be fixed.

bringe17:01:24

Please make an issue if that is the case, and maybe we can get @ericdallo in on it.

borkdude17:01:13

@pez I don't know what he was referring to

ericdallo17:01:22

me and @snoe are focused on merging the integration with clj-kondo, which probably will solve that too, but a issue on clojure-lsp tro track the bug may help

👍 3
pez17:01:04

@borkdude Some people actually get two prompts when Calva starts currently. Maybe that is overwhelming for some. Though I suspect that here it is really Parinfer that is the deal breaker. Calva actually works pretty well with the Parinfer extension, but there is no smartmode for sure.

borkdude17:01:24

To be honest, I got a little bit annoyed by Calva indentation when I was in VSCode the other day, in how it indents when you press tab, eating up newlines e.g.:

(comment
  (svc/clear-cache!)
  (svc/reset)


  <tab>
  )
=>
(comment
  (svc/clear-cache!)
  (svc/reset))
is there a way to turn that off?

borkdude17:01:59

I do want indentation on tab, just not that aggressive

borkdude17:01:34

(probably because I'm not used it normally in emacs, annoyance by having to change my habits)

borkdude17:01:39

Btw, I just fired up VSCode, to test this. It prompted me to uninstall the clj-kondo extension. But now I get no linting whatsoever in my /tmp/foo.clj script...

pez17:01:16

Issue please. ❤️

borkdude17:01:48

I'll leave that to you as an optional thing to do, it wasn't my intention to discover more issues after the one I mentioned. I use VSCode only occasionally. So do with this whatever you want :).

pez17:01:44

I think you have more context here than I have. I feel the presence of something that has broken, but would appreciate to have your phrasing of the issue.

bringe17:01:07

I'll make an issue and look into it, thanks! I think this is maybe because what files the clj-kondo extension feeds into kondo and what files clojure-lsp feeds in are different by default. Just a guess though so far.

borkdude17:01:26

This is my code in /tmp/foo.clj

(ns foo (:require [clojure.set :as set]))

(set/onion) ;; onion should be union

(defn x [])

(comment 
  x
  y
  (+  1)
  (+ (1 2 3))
  (/ "foo")
 
  )

borkdude17:01:43

I tried if adding a /tmp/deps.edn helped, but no avail

bringe17:01:11

So are you opening the /tmp directory in VS Code?

bringe17:01:42

I'm assuming you mean the system /tmp, and not a /tmp in a project directory?

bringe17:01:03

Or just opening the single file by itself?

borkdude18:01:47

yeah, global /tmp

👍 3
borkdude18:01:53

sorry, was away for dinner

pez17:01:58

It can’t currently be configured away. Calva has two modes: format-on-demand and format-on-type. The former is aggressive, the latter leaves empty lines and the paren trail alone. However, your example should result in

(comment
  (svc/clear-cache!)
  (svc/reset)


  )
If it doesn’t, then that is a bug.

borkdude17:01:43

In my editor it becomes

(comment
  (svc/clear-cache!)
  (svc/reset))
:/

bringe17:01:58

I think he's hitting tab though, in which case I thought that was intended. I may be wrong though.

pez17:01:06

This is how it is supposed to work.

borkdude17:01:02

Can you make it avoid eating up newlines?

borkdude17:01:29

if you press tab a second time it will even eat up the newlines above the cursor

borkdude17:01:46

This may all be intentional, just not what I'm used to ;)

pez17:01:07

It’s intentional. So, I forgot to mention the third mode: If you press tab when the paren trail is folded and tucked to the cursor, it get’s really aggressive. 😃 But you can certainly configure the formatter to leave empty lines alone. It’s cljfmt after all: https://calva.io/formatting/#configuration

borkdude18:01:12

So where should one put this config?

borkdude18:01:15

> The cljfmt docs mention the :cljfmt config key of Leiningen projects. Calva does not yet read the config from there, so if your Leiningen project has such a configuration, you will need to copy it out into a file.

pez20:01:10

There’s a setting, calva.fmt.configPath, where you can specify which file.

borkdude17:01:47

Here's the before and after: