VSCode-Hungry-Delete
VSCode-Hungry-Delete copied to clipboard
Simulate intelliJ behavior: do not delete line if whitespace is bigger than the smallest one
Hi, thanks for the extension! I was looking for it after getting used to this feature (which is built-in) in intellij. However, there's one thing missing for the extension to match intellij's feature.
Let's say I have this code:
const Component = () => (
<div>
<p>Hello!</p>
</div>
)
The <p>
tag has more whitespace than it should in the beggining of the line, but with this extension it's impossible to fix it, because pressing backspace will delete all the whitespace completely.
Intellij is smarter, and it can check that the line with least whitespace is the one holding <div>
, so it will only delete the line on <p>
if you press backspace until it has exactly the same amount of whitespace as <div>
. Would it be possible to achieve the same behavior in vscode?
A robust solution is to get the language configuration of vscode and determine the indentation with IndentationRule. However, this approach is not possible at this moment because vscode doesn't have API to access the language configuration.
A workaround (hack) solution is to do duplicate the language configuration in this extension's configuration, and use that configuration to determine the indentation.
I would also really like this.
The issue you linked needs 20 upvotes to get moved to the backlog. It has 19 now. Please upvote it if you haven't already.