Closed merrickluo closed 6 months ago
I remember we had a somewhat similar issue in the past but I'm not sure if it was javascript or rust or something else. Should not be extremly difficult to fix.
Looks like #789 ? if I copy sp-rust-skip-match-angle-bracket
to smartparenst-html.el it works.
(defun sp-javascript-skip-match-angle-bracket (_ms _mb me)
"Non-nil if we should ignore the bracket as valid delimiter."
(save-excursion
(goto-char me)
(sp--looking-back-p (rx "=>") nil)))
(sp-with-modes sp--html-modes
(sp-local-pair "<" ">"
:skip-match 'sp-javascript-skip-match-angle-bracket)
(sp-local-tag "<" "<_>" "</_>" :transform 'sp-match-sgml-tags :post-handlers '(sp-html-post-handler)))
I think it would better fit in smartparens-javascript.el
, after all the arrow is part of js syntax.
Would you be interested in creating a pull request?
I'd like to.
Fixed in 04f94b8ce207f9476b39eb397486e87c8507c84e
Expected behavior
should be able to
kill-region
on a javascript arrow function in rjsx-mode with smartparens-strict-mode.Actual behavior
user-error: Can not kill the region: the buffer would end up in an unbalanced state after deleting the active region
Steps to reproduce the problem
kill-region
Environment & version information
smartparens
version: 20180308.1042major-mode
:rjsx-mode
M-x emacs-version
): GNU Emacs 25.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.26) of 2018-02-09I think
>
is the problem here since it also needed to be paired in HTML, I wonder if this can be done? I really like the idea of smartparens-strict-mode, and want to use it in every mode. I can also press C-k before the function twice to do the same thing, but the muscle memory is really hard to resist(