Fork me on GitHub
#chlorine-clover
<
2021-02-01
>
ivana17:02:55

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?

seancorfield17:02:45

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

ivana17:02:06

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

seancorfield17:02:54

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

ivana18:02:57

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

mauricio.szabo18:02:08

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 😄

mauricio.szabo18:02:24

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

seancorfield18:02:28

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

pez19:02:21

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

seancorfield19:02:36

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.

seancorfield19:02:01

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

pez21:02:08

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.

seancorfield21:02:23

I don't use Calva in VS Code -- there is a Strict Paredit forked from Calva's version https://github.com/ailisp/strict-paredit-vscode (which is what I use). There's also another Paredit for VS Code: https://github.com/clptn/code-paredit and then this is the Parinfer I use: https://github.com/oakmac/vscode-parinfer

pez21:02:25

Then the autoindent you see is probably performed by Parinfer.

seancorfield21:02:49

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.

pez22:02:36

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

borkdude19:02:29

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

borkdude19:02:05

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

clyfe20:02:06

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 https://github.com/clyfe/calva-extras extension bits + my https://github.com/clyfe/vscode-calva-setup/ 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).

seancorfield20:02:42

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

clyfe21:02:12

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

seancorfield21:02:23

I don't use Calva in VS Code -- there is a Strict Paredit forked from Calva's version https://github.com/ailisp/strict-paredit-vscode (which is what I use). There's also another Paredit for VS Code: https://github.com/clptn/code-paredit and then this is the Parinfer I use: https://github.com/oakmac/vscode-parinfer

pez21:02:42

It has been suggested that we give Calva an option to surface only its static features (clojure-lsp things, syntax highlighting, formatting, paredit). https://github.com/BetterThanTomorrow/calva/issues/1005 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?

seancorfield21:02:36

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

👍 1
ivana22:02:23

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 🙂

borkdude22:02:33

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)

borkdude22:02:05

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.

borkdude22:02:19

yeah, that one

ivana22:02:00

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 )

ivana22:02:17

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?

borkdude22:02:04

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

ivana22:02:36

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

seancorfield22:02:34

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

ivana22:02:42

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

seancorfield23:02:33

I link to both recordings from this blog post https://corfield.org/blog/2020/11/24/talks-clojures-superpower/

1
👍 1
ivana23:02:32

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 https://github.com/Ivana-/bb-debug