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…
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.
Indeed. That’s the intended behaviour. Let’s see what @brandon.ringe can tell us about any difficulties with this.
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.
Another example: Ctrl+D (kill list) should be able to delete a top level form if in front of it.
A when context for this might be in place, it sounds like?
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.
A !calva:inSexp
flag would allow branching between selectCloseList
& selectForwardSexp
, the latter works top-level.
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.
calva.isTopLevel
, maybe?
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. 😃
Yass! https://github.com/clyfe/vscode/blob/main/killToClipboard.js
Some feedback: https://twitter.com/ahmedlhanafy/status/1351188378432241669
I would also LOVE to have parinfer smart mode in VSCode. Ah well, can’t have it all 😉
The prompts and options?
@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.
Please make an issue if that is the case, and maybe we can get @ericdallo in on it.
@pez I don't know what he was referring to
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
@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.
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?I do want indentation on tab, just not that aggressive
(probably because I'm not used it normally in emacs, annoyance by having to change my habits)
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...
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.Here's the before and after:
In my editor it becomes
(comment
(svc/clear-cache!)
(svc/reset))
:/Issue please. ❤️
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 :).
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.
I think he's hitting tab though, in which case I thought that was intended. I may be wrong though.
This is how it is supposed to work.
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.
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")
)
I tried if adding a /tmp/deps.edn helped, but no avail
Can you make it avoid eating up newlines?
if you press tab a second time it will even eat up the newlines above the cursor
This may all be intentional, just not what I'm used to ;)
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
Thanks :)
So are you opening the /tmp
directory in VS Code?
I'm assuming you mean the system /tmp, and not a /tmp in a project directory?
Or just opening the single file by itself?
yeah, global /tmp
sorry, was away for dinner
So where should one put this config?
> 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.
"a file"?
There’s a setting, calva.fmt.configPath
, where you can specify which file.