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

Space after line break #62

Closed
doyou89 opened this issue May 26, 2020 · 5 comments · Fixed by #73
Closed

Space after line break #62

doyou89 opened this issue May 26, 2020 · 5 comments · Fixed by #73

Comments

@doyou89
Copy link

doyou89 commented May 26, 2020

Minimal code example:

What the code looks like before pressing enter:

result = my_func(first_argument, second_keyword=some_value1,| third_keyword=some_value2)

What I want the code to look like after pressing enter:
(no space between cursor and third_keyword)

result = my_func(first_argument, second_keyword=some_value1,
                |third_keyword=some_value2)

What the code actually looks like after pressing enter:
(but space left between cursor and third_keyword)

result = my_func(first_argument, second_keyword=some_value1,
                | third_keyword=some_value2)
@kbrose
Copy link
Owner

kbrose commented May 28, 2020

Thanks for the issue. Definitely not desired behavior.

I think one possible solution is to always trim whitespace to the right of the cursor before going into any of the additional logic, I'm just trying to think if there are legitimate use cases where we'd want to preserve that whitespace...

@MatthewFlamm
Copy link

To add to this, can it trim the whitespace if done this way?

result = my_func(first_argument, second_keyword=some_value1, |third_keyword=some_value2)

The desired result as in the initial post:

# Following line has no whitespace at the end
result = my_func(first_argument, second_keyword=some_value1,
                |third_keyword=some_value2)

The current behavior results in:

# Following line has a whitespace at the end
result = my_func(first_argument, second_keyword=some_value1, 
                |third_keyword=some_value2)

@doyou89
Copy link
Author

doyou89 commented Aug 13, 2020

To add to this, can it trim the whitespace if done this way?

result = my_func(first_argument, second_keyword=some_value1, |third_keyword=some_value2)

The desired result as in the initial post:

# Following line has no whitespace at the end
result = my_func(first_argument, second_keyword=some_value1,
                |third_keyword=some_value2)

The current behavior results in:

# Following line has a whitespace at the end
result = my_func(first_argument, second_keyword=some_value1,<space>
                |third_keyword=some_value2)

In the above case, I think It should be left as it is intended.

@kbrose
Copy link
Owner

kbrose commented Aug 25, 2020

@MatthewFlamm I prefer to defer tasks like that to VSCode's files.trimTrailingWhitespace setting:

When enabled, will trim trailing whitespace when saving a file.

@kbrose
Copy link
Owner

kbrose commented Oct 27, 2020

@doyou89 This should now be fixed. Make sure you upgrade to version 1.12.0 (or later) of the package.

If you have any issues with the behavior, please comment here or open a new issue.

Thank you for your patience!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants