Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

keep one space? #5

Open
nanxiaobei opened this issue Jan 16, 2018 · 5 comments
Open

keep one space? #5

nanxiaobei opened this issue Jan 16, 2018 · 5 comments

Comments

@nanxiaobei
Copy link

Can it keep one space after last word of previous line after backspace? like WebStorm's default behavior.

@Jasonlhy
Copy link
Owner

Jasonlhy commented Jan 17, 2018

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

@Jasonlhy
Copy link
Owner

I just added this feature in 1.5.0 but it doesn't consider the cursor position. You can try try.

@nanxiaobei
Copy link
Author

@Jasonlhy
Thanks~

@olavim
Copy link

olavim commented May 14, 2018

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.

@Jasonlhy
Copy link
Owner

@olavim Noted, may add this feature in the weekend

@Jasonlhy Jasonlhy reopened this May 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants