mickeynp / combobulate

Structured Editing and Navigation in Emacs with Tree-Sitter
GNU General Public License v3.0
945 stars 54 forks source link

combobulate-kill-node-dwim makes code invalid #36

Closed DamienCassou closed 1 year ago

DamienCassou commented 1 year ago

Given this code in js-ts-mode:

function f() {
    return 2;
}

and my point is at the beginning of the first line, I would expect combobulate-kill-node-dwim to kill the whole function. Unfortunately, it only kills the function keyword (which I could have done with M-d).

mickeynp commented 1 year ago

M-k is a bit... confusing at the moment. I'm still deciding how I think it should work longer term as I am looking for ways to distinguish it from other things. Right now it occupies a weird inbetween space. One thing you could try is adding "function_declaration" to combobulate-navigation-sexp-nodes in combobulate-after-setup-hook (being sure to check major-mode so you set it in the right major mode). Now C-M-k will kill the function declaration in its entirety. In this case C-M-h will also work; ditto M-h though of course they mark first instead of just killing.

DamienCassou commented 1 year ago

I had several problems with Emacs 29 and switched back to 28.2. I won't be able to do more tests or give more feedback. I will close the issue now and reopen if I still have any issue about that. Sorry for the noise.