Incorrect indentation after string literals containing escaped characters
See original GitHub issueSteps to reproduce:
- Type string with ‘\n’ in it, press Enter.
a = '\n'
Same for double quotes.
Expected behaviour
a = '\n'
<--- cursor should be here
Actual behaviour
a = '\n'
<--- cursor is here
Environment data
- VS Code version: 1.30.2
- Extension version (available under the Extensions sidebar): 2019.1.0
- OS and version: Windows 10
- Python version (& distribution if applicable, e.g. Anaconda): 3.7
- Type of virtual environment used: N/A
- Relevant/affected Python packages and their versions: none
Logs
Console:
Starting Jedi Python language engine.
Linter 'pylint' is not installed. Please install it or select another linter".
Error: Module 'pylint' not installed.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:5
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Proper indentation for multiline strings? - python
Docstrings are treated specially: any indent of the first line is removed; the smallest common indent taken over all other non-blank lines is...
Read more >[Review] SE-0168: Multi-Line String Literals - Swift Forums
For instance, it's good practice to put either a space, or a newline and indentation, between array and dictionary literal delimiters or curly...
Read more >Multiline template strings that don't break indentation
Solution 1: Ignore all space and tab characters following a newline until the first non-space or tab character. The problem with this is...
Read more >Appendix: YAML Techniques - Helm
You can escape line breaks with \n . Single-quoted strings are "literal" strings, and do not use the \ to escape characters. The...
Read more >2. Lexical analysis — Python 3.11.1 documentation
A comment starts with a hash character ( # ) that is not part of a string literal, and ends at the end...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I am not familiar with the code, but it may be this string: https://github.com/Microsoft/vscode-python/blob/c23603c9b7a3dbb805e8339a2d7cf01bb7327b34/src/client/extension.ts#L176 since regex doesn’t include end of line.
I’ve verified that the following indent/dedent properly: