- Notifications
You must be signed in to change notification settings - Fork18
Introduce threading refactoring commands#89
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
50c8809 tod9ae5fcComparerrudakov commentedApr 29, 2025
Weird, I didn't close it. I guess GitHub did it somehow :) |
Uh oh!
There was an error while loading.Please reload this page.
clojure-ts-mode.el Outdated
| (and (clojure-ts--list-node-p second-child) | ||
| (> (treesit-node-child-count second-childt)1)))) | ||
| (defunclojure-ts-thread () |
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.
Shouldn't this raise some error if the form at point is not threadable?
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.
Inclojure-ts-mode it just returnsnil, I did the same here. Maybe because it's used in a loop in boththread-first-all andthread-last-all?
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.
Much of the refactoring code was copied fromclj-refactor in bulk early on, so I didn't pay close attention to each command there - that's why I notice some stuff for the first time.
I think it probably makes sense to have an optional param controlling whether to raise an error or returnnil, and perhaps even introduce some lower-level function that's not actually command that all of the commands call. (extracted fromclojure-ts-thread)
Any rate - what you're doing right now is a great opportunity for us to examine closely each refactoring command and make them slightly better here and there in the process of porting them toclojure-ts-mode.
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 agree, I already discovered a few issues inclojure-mode commands and fixed them inclojure-ts-mode implementation.
I updated this function, it signalsuser-error now if called interactively and there is no threading form.
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 think it probably makes sense to have an optional param controlling whether to raise an error or return
nil, and perhaps even introduce some lower-level function that's not actually command that all of the commands call. (extracted fromclojure-ts-thread)
Perhaps we could look into it when we port more refactoring commands and see some pattern that can be extracted.
bbatsov commentedApr 29, 2025
I wouldn't say that's particularly important. |
d9ae5fc to63ab3d9Compare63ab3d9 toaace501Compareaace501 to2fcc5c7Compare3569c90 intoclojure-emacs:mainUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
All related tests from
clojure-modepass except of those which "unjoin" lines, inclojure-modeit's implemented via text properties and doesn't work for the same expression after restarting Emacs. If it's an important feature, we can deal with that later.I also fixed a couple of small issues with indentation and aligning forms.
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!