Hi. Is there any "common" package, which would offer similar functionalities such as the new "calva power tools" that recentyly got added to #calva? (https://www.reddit.com/r/Clojure/comments/1kllbw7/introducing_calva_power_tools/) Ie: for example interactive functions for dynamic adding of snitch dependencies & then multiple Stitch-related (instrumentation etc) functions. Or does anyone here have a similar collection of their own functions doing similar stuff?
I must have seen something similar already somewhere, but can't remember where. I guess it would be lovely to have similar set of functions as those in calva power tools, all nicely packed and ready at your fingertips in one package.
Best bet would be to dig into the Calva source code, I reckon that it's Clojure code that could be extracted in some way (or even just copied for a quick POC)
Either way, you can use those tools and then some more via Emacs and/or cider, clojure-lsp specifically I haven't tried these "power tools", but in the end it boils down to: • the tools themselves (you already have them) • a nice UI for a command palette (can be achieved, for instance clj-refactor uses Hydra, and clojure-lsp uses lsp customs)
It’s very little code involved. https://github.com/BetterThanTomorrow/calva-power-tools
In this visual tools demo, in the first presentation https://www.youtube.com/watch?v=2VOXxG_7VGk&t=28s @mb presented a tool he’s made for transient commands with cider, one of them was adding snitch to runtime. It is a good starting point. He made this emacs package for it: https://github.com/licht1stein/context-transient.el I’d love this thread to evolve into a ready made power tools version for emacs Hope this helps!
@ovi_b that must be the I must have seen something similar already video. Thank you!
context-transient.el seems like a nice "housing" for similar features that calva-power-tools offers.
> I'd love this thread to evolve into a more polished version for emacs Same.
The UI looks polished to me. 😃
Regarding requiring Snitch, it only needs to be done once for a repl session. Calva Power Tools does it as part of loading the dependency and doesn’t have a separate command for it. May not be the optimal way to do it, but just noting.
By polished I meant, using context-transient.el to have a set of ready made tools like calva power tools. The transient menu is great imo
Thank you! I never needed anything else from it, so the UI is ok. Requiring snitch is just a command, like many others, and is very useful when debugging prod. But I would not want it to automatically be required every time I connect to the prod repl.
Me neither! Not in dev either.
Saying that there’s nothing stopping you from adding it to some sort of a custom jack-in command, but it seems pressing something like F7 t s once per dev session is not too much work 🙃
I also have a command to remove all snitch forms in a buffer.
Calva Power Tools has a command for loading the Snitch dependency. And does require as part of that.
Sure, you can implement anything like that with context-transient’s defclj macro
This is awesome and I don’t I need more haha
I wish VS Code was dynamic like that. 😍
Emacs is the way 🌌
Here’s one more for you @ovidiu.stoica1094
(defun clj-remove-snitches ()
"Remove all snitch tools from buffer."
(interactive)
(save-excursion
(goto-char (point-min))
(while (re-search-forward (regexp-opt '("defn*" "*let" "*fn" "defmethod*")) nil t)
(replace-match (replace-regexp-in-string "*" "" (match-string 0)) nil nil))
(goto-char (point-min))
(while (re-search-forward (regexp-opt '("#p ")) nil t)
(replace-match ""))))