VSCode-Hungry-Delete
VSCode-Hungry-Delete copied to clipboard
multicursor instances breaks hungry delete
v1.6.0 To reproduce:
- create a new file
- set up a bunch of whitespace-only lines in the file (IDE may fight you if you have trailing whitespace deletion configured)
- do a multicursor selection with overlapping whitespace regions.
- do hungry delete command.
example (dots indicate whitespace, vertical bars are cursors):
.......|
.......|
.......|
You will get this message:
Running the contributed command: 'extension.hungryDelete' failed.
Desired behavior:
- if all instances of the multiple cursors have whitespace preceding them then they should all be deleted according to user's settings.
- if any instances of the whitespace would overlap within the delete content of a cursor, those cursors should merge into a single cursor instance. Any overlapping whitespace should probably be wholly deleted ignoring the keep-a-space rule - perhaps detect the condition of All the whitespace instances having a match for that rule.
Oops, initially I thought this occurred for all instances, it is slightly more restrictive than that, editted.
I don't know what reasonable behavior is for mixed selections of whitespace and text. With word-delete as the other behavior for ctrl-delete the behavior is currently to do word-delete where appropriate and hungry delete where appropriate. this seems acceptable, its what the user would expect the extension to do.
@biblicabeebli I think it make sense to merge the delete range
May be: Range.Start = 1st overlapped hungry-delete-range end Range.End = last overlapped hungry-delete-range end
Since posting quite a while ago there has been some improvement in the behavior such that it sometimes works desirably, but there are cases where it still crashes. I will try and remember to work out what the scenario is and post it, I think it is when there are separated sections or multiple ranges that end up getting merged.