Jasonlhy / VSCode-Hungry-Delete

To delete an entire block of whitespace or tab, and reduce the time programmers need to press backspace
https://marketplace.visualstudio.com/items?itemName=jasonlhy.hungry-delete
MIT License
45 stars 4 forks source link

Ctrl/Option + Backspace deletes too much in JSON files #29

Open alinnert opened 2 years ago

alinnert commented 2 years ago

When I want to delete a word in a JSON file using ctrl + backspace (Windows) or option + backspace (Mac) in a JSON file this extension instead deletes everything until including the next occurring ".

Example:

{
  "key": "this is some| value"
                      ^ cursor
}

After hitting ctrl/option + backspace I get this:

{
  "key": | value"
         ^ cursor
}

This is not what I expect to happen. Only the word some should be deleted in this case. I've noticed this behavior only in JSON files. And it disappears as soon as I disable this extension.

Natedude commented 2 years ago

I came here to post about this problem. I came across it when editing my VSCode settings JSON. Very annoying!

Maybe try looking into the extension code at the findDeleteWorldLeftStartPosition() function...

If I figure out a hack, I will share and maybe do a pull request. LMK if you find a fix, please.

Jasonlhy commented 2 years ago

@alinnert I can't reproduce your problem

I think the problem is something like this? Usually this is not a problem, but myself did find it quite annoying when editing the JSON file ....

Will be fixed in next release

{ "person"|: "value"" }

become { ": "value" }

alinnert commented 2 years ago

@Jasonlhy it seems this issue really doesn't exist anymore. If you didn't fix it, I guess it was a bug in VS Code itself and it has been fixed on their side. 🤷‍♂️

In that case this issue can be closed. Unless you want it to stay open because you've mentioned another problem.