Open nanxiaobei opened 6 years ago
I can just add a setting to implement this feature. However, I find out WebStorm implementation do not always keep one space after the last word of previous line.
Not keep one space example:
<script src="js/plugins.js"></script>
|<script src="js/main.js"></script>
after pressing backspace =>
<script src="js/plugins.js"></script>|<script src="js/main.js"></script>
Their implementation only keep one space after the last word of previous line if the cursor is located at specific type of text such as html attribute and html innerText
Keep one space example 1:
<link rel="stylesheet"
|href="css/main.css">
after pressing backspace =>
<link rel="stylesheet" |href="css/main.css">
Keep one space example 2:
<p>Hello
|world! This is HTML5 Boilerplate.</p>
after pressing backspace =>
<p>Hello |world! This is HTML5 Boilerplate.</p>
But it seems that there is no API can get the token type (scope) of text under the cursor position. Reference
I just added this feature in 1.5.0 but it doesn't consider the cursor position. You can try try.
@Jasonlhy Thanks~
Would it be possible to add an option for exceptions after which a space should be added/removed? So as an example if I had a configuration such as
"hungryDelete.keepOneSpace": true,
"hungryDelete.keepOneSpaceExceptions": [">", "{", "("]
then the behavior in your examples would be in line with WebStorm. This isn't the perfect solution, but would be a big improvement nonetheless.
@olavim Noted, may add this feature in the weekend
Can it keep one space after last word of previous line after backspace? like WebStorm's default behavior.