This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-09-02
Channels
- # announcements (21)
- # bangalore-clj (1)
- # beginners (122)
- # calva (29)
- # cider (9)
- # cljdoc (1)
- # cljs-dev (7)
- # cljsrn (1)
- # clojure (84)
- # clojure-dev (11)
- # clojure-europe (2)
- # clojure-houston (2)
- # clojure-italy (31)
- # clojure-nl (5)
- # clojure-uk (37)
- # clojuredesign-podcast (3)
- # clojurescript (14)
- # cursive (66)
- # data-science (5)
- # datavis (1)
- # datomic (6)
- # fulcro (16)
- # graphql (4)
- # jobs (2)
- # music (1)
- # off-topic (20)
- # pedestal (1)
- # re-frame (2)
- # reagent (2)
- # shadow-cljs (155)
- # spacemacs (5)
- # tools-deps (5)
- # vim (8)
- # yada (1)
@pez - is there any way you can write a simple feature where I am allowed to take an s-exp and turn it into a threading macro-based one?
Something like this: https://gist.github.com/craftybones/ebfcaabcab103681743c1994484d3a65
If selected text could be sent to a function like that and upon success substitute the selection with the result
I could always surround the selected text with a fn call, but having that available as a shortcut would be really dandy
Will do
Thanks
If you come up with a way to wind a threaded form to it's non-threaded counterpart. that would be nice as well. 😃
Like a macroexpand? 😄
macroexpand I think we can also do, but using nREPL. 😃 But, yeah, maybe it is like a macroexpand.
We will need a way to format the code as well, so this might take a while to implement. Not sure what would be the best way to do it. But a solid cljc library is a good start. 😃
How are you currently reading code and parsing forms?
What if you don’t do this at all. What if you simply handoff to nREPL? Instead of thinking about it as a core Calva feature, you could simply create an infrastructure that lets people execute custom functions over the wire
So, selected code, along with context and a key of some sort like “wind thread” or “unwind thread” or something of that nature gets sent, and nREPL middleware handles it?
So, there is a Calva command today for replacing the evaluated code with its results. We could maybe do this by using that but wrapping the form in a (wrangle <form>)
… Maybe even (do (defn wrangle ... ) (wrangle <form>))
?
With that we could have a command that was Transform current form… which would pop open a menu with selections of transformations, of which wrangle
would be one.
The difference between 5 and 7 is that I’ve evaluated 5 while my cursor was next to +, while with 7 I had selected both ` and + (the whole form).
Hello. Iircc (can’t check right now) Calva’s selection of “current” form is pretty lame. So the difference between 5 and 7 would be that in the first case this lame current form is used and in the second case you dodge that by using a selection instead. There is a related issue about this, having to do with that Calva should disregard some whitespace when determining the current form. Add this to that issue, is my suggestion. We have much smarter tools for this current form thing now, than was the case before, so this should be entirely possible to fix.