autoCloseBrackets misbehaves with Python string prefixes
See original GitHub issueEntering '
in a Python editor will automatically insert the closing '
, as it does for brackets. Entering u'
, r'
, ur'
or b'
(case-insensitive) may also indicate the start of a string, but is misinterpreted as closing a string, so '
is not auto-inserted. Entering an empty byte-string (in Python 3), b''
will automatically append a third apostrophe!
Similarly, the heredoc-like string syntax in Python is not supported: '''
should be closed by '''
(instead, a fourth apostrophe is inserted); """
should be closed by """
.
Issue Analytics
- State:
- Created 10 years ago
- Comments:10 (9 by maintainers)
Top Results From Across the Web
autoCloseBrackets misbehaves with Python string prefixes
Entering ' in a Python editor will automatically insert the closing ', as it does for brackets. Entering u', r', ur' or b'...
Read more >python f-string auto close (match bracket) - v6 - CodeMirror
I noticed that this commit removed auto-closing of brackets inside string literals. What if this is was my preference (in python)?
Read more >2. Lexical analysis — Python 3.11.1 documentation
Bytes literals are always prefixed with 'b' or 'B' ; they produce an instance of the bytes type instead of the str type....
Read more >python - What exactly do "u" and "r" string prefixes do, and ...
Raw string literals, with an "r" prefix, escape any escape sequences within them, so len(r"\n") is 2. Because they escape escape sequences, you...
Read more >How to Remove a Prefix or Suffix from a String in Python
Using the str.removeprefix() method, we were able to pass in the string prefix that we wanted to remove. Keep in mind that Python...
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 Free
Top 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
another case a python 3.6 “format strings”, i.e. they start with
f"
orf'
or for raw strings, e.g.rf'a b \n {x} d'
is a prefix ofrf
is possible.For completeness, checking for word characters prevents
don't
from turning intodon''t
, for example.