-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Indent when doing line breaks #3284
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
Comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
#481 is certainly related because it also concerns proper PEP8-style indentation. |
This issue was moved to microsoft/python-language-server#385 |
I'm pretty sure this isn't a language server problem. The extension tells the editor what to do on enter here: This is distinct from |
This comment has been minimized.
This comment has been minimized.
Adding this seems to work (handling comments and ignoring all-whitespace prefixes): {
beforeText: /^(?!\s+\\)[^#\n]+\\\s*/,
action: { indentAction: IndentAction.Indent }
}, |
Though, commented out line continuations are syntax errors, so that regex is probably overkill:
|
Would expecting indents after breaking a line of inputs be in the same issue? subprocess.run(termqry,
shell=True,
heck=True) vs subprocess.run(termqry,
shell=True,
check=True) or is this a simple preference setting? |
The latter is strongly preferred in the Python community since it is standardized in PEP8. This is also much more important than indentation after a backslash (as in the top example), which almost never happens in Python code. Adding to your example, this would also be the expected behavior:
and not
So basically it's about how to indent after breaking inside of all kinds of brackets. |
Thank you Clemens, that is helpful. You are right about the brackets, I hope the change goes through. |
Currently this is not possible. You can manually indent the second line, which will then correctly indent all subsequent lines. But this is very cumbersome, hence this issue. |
Will be addressed as part of #481 |
Reopening to PR in my line continuation rule. |
Prescribed Solution:
There may be a more correct regex to use:
See #5821 (comment). |
Closing as fix for #4241 will cover it. |
Feedback from twitter here: https://twitter.com/amuellerml/status/1060895092230291457
Actual behavior
Expected behavior
The text was updated successfully, but these errors were encountered: