expez / evil-smartparens

Evil integration for Smartparens
GNU General Public License v3.0
134 stars 17 forks source link

Rust: comment with single quote causes hang in evil-sp-delete-line #54

Open mullr opened 3 years ago

mullr commented 3 years ago
fn test() {
    let broken = 12;
    // can't don't   
    let ok = 1;
}

It seems like two are required.

mullr commented 3 years ago

Breaking execution with debug enabled gives:

  sp-point-in-string()
  sp--do-action-p("(" navigate)
  sp--get-allowed-stringlike-list()
  sp--get-stringlike-regexp()
  sp-get-stringlike-expression(nil)
  sp-get-stringlike-or-textmode-expression(nil #("'" 0 1 (face font-lock-comment-face fontified t)))
  sp-get-expression(nil)
  sp-get-sexp()
  sp-get-enclosing-sexp(1)
  sp-up-sexp(-1 nil)
  sp-backward-up-sexp()
  evil-sp--depth-at(22)
  evil-sp--get-endpoint-for-killing()
  evil-sp-delete-line(nil nil nil nil)
  funcall-interactively(evil-sp-delete-line nil nil nil nil)
  command-execute(evil-sp-delete-line)

A few more samples:

  sp--syntax-ppss(38)
  sp-point-in-comment()
  sp-get-comment-bounds()
  sp-get-stringlike-expression(nil)
  sp-get-stringlike-or-textmode-expression(nil #("'" 0 1 (face font-lock-comment-face fontified t)))
  sp-get-expression(nil)
  sp-get-sexp()
  sp-get-enclosing-sexp(1)
  sp-up-sexp(-1 nil)
  sp-backward-up-sexp()
  evil-sp--depth-at(23)
  evil-sp--get-endpoint-for-killing()
  evil-sp-delete-line(nil nil nil nil)
  funcall-interactively(evil-sp-delete-line nil nil nil nil)
  command-execute(evil-sp-delete-line)
Debugger entered--Lisp error: (quit)
  sp-point-in-comment()
  sp-get-comment-bounds()
  sp-get-stringlike-expression(nil)
  sp-get-stringlike-or-textmode-expression(nil #("'" 0 1 (face font-lock-comment-face fontified t)))
  sp-get-expression(nil)
  sp-get-sexp()
  sp-get-enclosing-sexp(1)
  sp-up-sexp(-1 nil)
  sp-backward-up-sexp()
  evil-sp--depth-at(24)
  evil-sp--get-endpoint-for-killing()
  evil-sp-delete-line(nil nil nil nil)
  funcall-interactively(evil-sp-delete-line nil nil nil nil)
  command-execute(evil-sp-delete-line)
expez commented 3 years ago

Happy to take a PR, but this looks like something that happens in the intersection of sp and rust-mode.

mullr commented 3 years ago

I've noticed that sp-kill-hybrid-sexp does nearly the same thing as evil-sp-delete-line, so for the moment I've bound D to that. How is the behavior of the two supposed to differ? The only thing I've identified is that evil-sp-delete-line pays attention to structure inside of comments.

expez commented 3 years ago

I don't think sp-kill-hybrid-sexp existed at the time I wrote this package, so there might indeed be a fair amount of overlap!

One difference, that you might not care about, is that evil-sp-delete-line would handle e.g. the evil specific stuff like registers.