-
-
Notifications
You must be signed in to change notification settings - Fork 213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Paredit drag left/right commands should drag pairs inside maps and binding boxes #529
Comments
Bravo! That's awesome. Above and beyond expectations. I scanned Clojure's (doseq [x [-1 0 1]
y [1 2 3]]
(prn (* x y))) ;; with-redefs
(with-redefs [type (constantly java.lang.String)
class (constantly 10)]
(println (type []) " " (class []))) Plenty of other macros have bindings but not in pairs or they use hashmaps. For macros with "clauses" here's what I came up with: case
cond
condp
cond->
cond->>
The oddball is (condp apply [2 3]
= "eq"
< "lt"
> "gt")
;;=> "lt" In general, and specifically for custom binding macros, it is difficult to automatically determine if the items need to be moved in pairs. You might assume that if there are multiple lines with sets of two on each, that they are binding pairs. That may be challenging to implement and in my opinion probably not worth it. It would be worse if you're moving in pairs and the user doesn't want that. As an alternative, you could treat a selected region as a single s-expression. This would allow manually selecting two items to move them between other expressions. However, if I recall, there may have been an issue with the dragging with an active selection. Ideally the selection would be maintained. |
Thanks for helping with collecting these! It seems that with the clausy forms both |
how did you guys do the "drag"? what's the shortcut? |
@muhajirdev , search for ”Paredit drag” in the command palette. The commands and their shortcuts should appear. They are also listed here: https://calva.io/paredit/ That said, in the animation above, I use the default shortcuts:
I'm considering if we should change those shortcuts to something simpler. |
Probably should be careful there since that maps to moving lines up and down by default, but of course in Clojure that action doesn't make a lot of sense. Not saying it shouldn't be overridden 🤷♂️ |
Issue Type: Feature Request
In Cursive Paredit, the drag commands have special behaviour inside maps and binding boxes. Example:
Dragging left will do this:
I think Calva should follow the Cursive way here.
Ping: @bdevel
Update with demo gif:
The text was updated successfully, but these errors were encountered: