VSCode-Hungry-Delete icon indicating copy to clipboard operation
VSCode-Hungry-Delete copied to clipboard

Ctrl/Option + Backspace deletes too much in JSON files

Open alinnert opened this issue 3 years ago • 3 comments

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.

alinnert avatar Nov 23 '21 20:11 alinnert

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.

Natedude avatar May 08 '22 05:05 Natedude

@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" }

Jasonlhy avatar Jul 10 '22 16:07 Jasonlhy

@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.

alinnert avatar Sep 02 '22 16:09 alinnert