We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
What is the recommended way to fold jsx tags using rjsx-mode? I tried hide-show minor mode and origami but they all messed up the tags. Thank you!
The text was updated successfully, but these errors were encountered:
I don't use folding much in JSX, but I do use fold-this in other modes. Here's a quick-and-dirty folding function you can try:
fold-this
(defun rjsx-fold-tag-at-point () (interactive) (js2-mode-wait-for-parse (lambda () (let* ((node (rjsx--tag-at-point)) (child0 (car (rjsx-node-kids node))) (closer (and node (rjsx-node-closing-tag node)))) (cond ((null node) (message "No JSX tag found at point")) ((null closer) (message "JSX tag is void")) ((null child0) (message "JSX tag has no children")) (t (let* ((start (js2-node-abs-pos child0)) (end (js2-node-abs-pos closer))) (fold-this start end))))))))
It doesn't handle newlines, but should be enough to get you started!
As usual, PRs welcome for anyone wanting to add to rjsx core
Sorry, something went wrong.
No branches or pull requests
What is the recommended way to fold jsx tags using rjsx-mode? I tried hide-show minor mode and origami but they all messed up the tags.
Thank you!
The text was updated successfully, but these errors were encountered: