calva

Wednesdays you might find @U0ETXRFEW in the Gather Calva space. Invite is https://gather.town/invite?token=GZqrm7CR and the password is `Be kind`.
Stefan 2021-01-18T09:55:34.115400Z

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…

borkdude 2021-01-18T09:57:52.116500Z

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.

pez 2021-01-18T10:04:19.118Z

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

👍 1
clyfe 2021-01-18T12:03:23.121600Z

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.

clyfe 2021-01-18T12:05:33.122400Z

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

pez 2021-01-18T12:06:16.123500Z

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

pez 2021-01-18T12:09:58.127100Z

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.

clyfe 2021-01-18T12:14:44.128600Z

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

clyfe 2021-01-18T12:15:47.129800Z

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.

pez 2021-01-18T12:16:05.130100Z

calva.isTopLevel, maybe?

👍 1
pez 2021-01-18T12:17:02.130900Z

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

borkdude 2021-01-18T15:26:48.131800Z

Some feedback: https://twitter.com/ahmedlhanafy/status/1351188378432241669

👍 1
Stefan 2021-01-18T15:31:19.132400Z

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

pez 2021-01-18T15:46:33.132700Z

The prompts and options?

bringe 2021-01-18T17:14:52.134800Z

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

bringe 2021-01-18T17:15:24.135500Z

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

borkdude 2021-01-18T17:16:13.136400Z

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

ericdallo 2021-01-18T17:16:22.136600Z

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

👍 1
pez 2021-01-18T17:20:04.139200Z

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

borkdude 2021-01-18T17:22:24.140800Z

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?

borkdude 2021-01-18T17:22:59.141200Z

I do want indentation on tab, just not that aggressive

borkdude 2021-01-18T17:23:34.141500Z

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

borkdude 2021-01-18T17:28:39.144700Z

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

pez 2021-01-18T17:28:58.145100Z

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.

borkdude 2021-01-18T17:29:47.145300Z

Here's the before and after:

borkdude 2021-01-18T17:30:43.145800Z

In my editor it becomes

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

pez 2021-01-18T17:31:16.146Z

Issue please. ❤️

borkdude 2021-01-18T17:32:48.146200Z

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 :).

pez 2021-01-18T17:36:44.146600Z

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.

bringe 2021-01-18T17:40:58.146800Z

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

pez 2021-01-18T17:42:06.147Z

This is how it is supposed to work.

bringe 2021-01-18T17:42:07.147400Z

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.

borkdude 2021-01-18T17:43:26.147700Z

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

borkdude 2021-01-18T17:43:43.147900Z

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

borkdude 2021-01-18T17:46:02.148100Z

Can you make it avoid eating up newlines?

borkdude 2021-01-18T17:46:29.148300Z

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

borkdude 2021-01-18T17:46:46.148500Z

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

pez 2021-01-18T17:50:07.148700Z

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

borkdude 2021-01-18T17:50:23.149Z

Thanks :)

bringe 2021-01-18T17:54:11.149200Z

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

bringe 2021-01-18T17:54:42.149500Z

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

bringe 2021-01-18T17:55:03.149700Z

Or just opening the single file by itself?

borkdude 2021-01-18T18:41:47.150100Z

yeah, global /tmp

👍 1
borkdude 2021-01-18T18:41:53.150300Z

sorry, was away for dinner

borkdude 2021-01-18T18:49:12.150600Z

So where should one put this config?

borkdude 2021-01-18T18:49:15.150800Z

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

borkdude 2021-01-18T18:49:21.151Z

"a file"?

pez 2021-01-18T20:48:10.151600Z

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