- Notifications
You must be signed in to change notification settings - Fork18
Introduceclojure-ts-add-arity refactoring command#93
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
| (defunclojure-ts-add-arity () | ||
| "Add an arity to a function." | ||
| (interactive) | ||
| (if-let* ((sym-regex (rx bol |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I'm guessing you can extract some private function checking whether the form at point is function-like. I assume that would be useful for other things down the road.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I've done a small refactoring in this PR and extracted some helper functions, such asclojure-ts--search-list-form-at-point orclojure-ts--list-node-sym-text orclojure-ts--parent-until (which I wish was part oftreesit.el). This particular regexp and the following query is very unlikely going to be used anywhere else, it's too specific. If I extracted it to a function I would have to give it a name that indicates that it returns a node that represents a construct to which an arity could be added. We can always extract it if we need it in other place.
a1fdc69 intoclojure-emacs:mainUh oh!
There was an error while loading.Please reload this page.
rrudakov commentedMay 11, 2025
Thanks for quick review! |
Before submitting a PR mark the checkboxes for the items you've done (if you
think a checkbox does not apply, then leave it unchecked):
M-x checkdocand fixed any warnings in the code you've written.Thanks!