Fork me on GitHub

Hello! Trying to interact with Clover on VSCode, also installed clj-condo linter. But can not found any formatter, which can format inside the current block only and by pressing customisable hotkey or Tab. What you can suggest?


@ivana I use Strict Paredit with VS Code to do indentation but I'm not entirely happy with it.


@seancorfield thanks alot, but I'm not use any structural editors


I can't imagine working with Clojure without structural editing support... 👀


Tried not recent calva-fmt and it works standalone, recommend it for par<...>-agnostics 🙂


Yes, unfortunately Clover do not add any "additional functionality" like linters or formatters... I'm not really a VSCode user so I don't know 😄


But I believe that other plug-ins will work better as formatters / linters on VSCode. I tried to hack a "parinfer-rust" implementation for VSCode (that could double as a formatter) but ran into lots of problems and API limitations really fast... 😞


Paredit and Parinfer both seem to hit limitations with VS Code -- they both behave differently to similar extensions for Atom, unfortunately.


I don't think paredit should run into any vscode limits?


Auto-indent when pressing enter does not seem to work the same in VS Code as in Atom @pez -- at least for the standalone Paredit extension.


I believe you have a variant of it bundled into Calva? Maybe that is functionally different to the standalone version.


I don’t know how it works in Atom and also which standalone version you are using. 😃 In Calva there is a Paredit and a formatter. Autoindent on enter is performed by the latter.


I don't use Calva in VS Code -- there is a Strict Paredit forked from Calva's version (which is what I use). There's also another Paredit for VS Code: and then this is the Parinfer I use:


Then the autoindent you see is probably performed by Parinfer.


Toggling the key map debugger, it seems like nothing is bound to Enter so I'm getting the default VS Code behavior. I guess that in Atom, with Paredit or Parinfer, plain old Enter is bound to some sort of insert-newline-and-indent which isn't provided by either of those in VS Code.


Probably. An extension can also implement an on type provider and do the formatting there. (Calva does it that way).


I think Calva is indenting using cljfmt, which threw me off a couple of times, coming from (and still mainly abiding in) emacs


(I mean "threw me off" in the sense of: didn't do what I expected and thus confused me, not sure if that's the intended meaning)


For folks that find it hard to paredit I propose "baby paredit" made of: • paredit movement (`ctrl+arrow`, jumps s-exps instead words) • normal selection (`ctrl+shift+arrow`, also used as movement fallback, ie. move via selection when paredit movement gets frustrating) • Alt+d paredit kill to clipboard - the one true command, used for: deleting (clipboard is overwritten), cutting (duh), copy'ing (extra undo needed). It's basically cut - but I use it for all the above, and so can you. • Some improvements to backspace such that it deletes directly to positions of interest (no intermediary spaces deletion). This is available via Calva + my extension bits + my settings. But otherwise, the ideas stand and can be configured on other tools too, and offer a leaner transition path to pro paredit (I'm not there yet myself).


I think wrap-with-paren/brace/bracket and slurp/barf are the things I use most in paredit.


I do everything with Alt+d & don't use anything else 🙂 (but I want to expand). wrap = position-to-start Alt+d paren paste;


I don't use Calva in VS Code -- there is a Strict Paredit forked from Calva's version (which is what I use). There's also another Paredit for VS Code: and then this is the Parinfer I use:


It has been suggested that we give Calva an option to surface only its static features (clojure-lsp things, syntax highlighting, formatting, paredit). I think that would make it half decent to use it side-by-side with Clover, Until we find the time to finish the work with separating out these things again, at least. Is that of interest to you Clover users?


@pez Getting all of the Calva goodies that don't relate to code eval/REPLs alongside Clover's Socket REPL eval stuff sounds like a "win" to me.

👍 3

I'm not very happy of Clover REPL integration (as I see, it even can not show result near the cursor at form, just in separate window only), but I had to switch off from Calva and didn't find any usable REPL-plugin yet, maybe it is time to think about creating my own. But for now it seems, that 3 main fearures I need are: • linter - there are a lot of them, but clj-condo is good, and seems that Calva also uses it, and it works standalone. Thanks @borkdude for solving this users point without any problems for them! • formatter - I still use early build of Calva-fmt. I tried cljfmt, but didn't find how to format block via hotkey in VSCode. Maybe one time someone creates a wrapper for it to more convinient usage as a standalone plugin. • REPL integration - Clover for now, though it is very limited even as this task solver, but I also didn't find any better solution for now. • structural editors, lsp, debugger, rocket science and other stuff fortunatelly not needed for me 🙂


There is also another nREPL based plugin which is the most popular vscode extension related to clojure, but the development of it doesn't seem to be very active. I haven't used it, but may be worth a try, if you can tolerate nREPL (I know, some prefer socket REPL, others nREPL)


It would be nice if one could mix and match their own preferences, either by a plugin which is configurable, or by multiple plugins that do less. But multiple plugins often come with more overhead.


yeah, that one


I tried it, and it can show result near the evaluated form (opposed to Clover), but have limitations in other things, or maybe I had to try it more active ) I'l try is one more time )


And about multiple plugins - as I remember, there is such a thing, like UNIX philosophy - it is better to have 10 functions, each one do its own local task, but do it well, than have 2 functions with a lot of settings & defaults 🙂 So maybe this way have a chance?


@ivana clj-kondo uses a JVM (currently, in VSCode, running as an LSP server). other tools might also spawn a JVM. If you use 10 plugins you might have 10 JVMs while they could be running in only one, if it was configurable.


Yep, everything has its own cost, as usual. And there is no silver bullet yet. If one solution was much better than another, everyone would use it only (sorry for possible mistakes in that hard conditional 2-form or how it calls 🙂)


@ivana I agree that losing inline result display (compared to Chlorine for Atom) is unfortunate but my "workaround" for that is to run Reveal as a visualization tool for REPL results -- see my recent talks online to Clojure Provo and London Clojurians for what that looks like. I find that Reveal offers a lot of value above and beyond what Clover/Chlorine offer in their REPL output that I typically don't even have the REPL panel visible in VS Code now and just rely on Reveal (except for occasional syntax errors where I still need to quickly switch to the REPL tab and back).


@seancorfield sounds very interesting and promising! I'l look at your stream about it.


I link to both recordings from this blog post

👍 3

For the first look it reminds me my watch/inspect always-on-top windows in my simple bicycle-like debugger I played with 2 years ago