-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Preserve r-string prefix capitalization #1244
Labels
F: strings
Related to our handling of strings
S: accepted
The changes in this design / enhancement issue have been accepted and can be implemented
T: bug
Something isn't working
T: enhancement
New feature or request
Comments
I'm fine with removing the casefolding. Should we do this only for |
I'm not aware of any other string prefixes where case matters. But then I only did a quick search just now. |
I would remove it for all string prefixes for consistency. |
hauntsaninja
pushed a commit
to hauntsaninja/black
that referenced
this issue
Feb 11, 2020
Reverse sort since that causes fewer changes on black's codebase. Resolves psf#1244
ambv
added a commit
that referenced
this issue
Mar 3, 2020
Resolves #1244 Co-authored-by: Łukasz Langa <lukasz@langa.pl>
This was referenced Mar 12, 2021
Was this issue reintroduced?
21.5b1 creates:
|
Can confirm that we lowercase docstring R prefixes now. |
ichard26
added
T: bug
Something isn't working
S: accepted
The changes in this design / enhancement issue have been accepted and can be implemented
labels
May 30, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
F: strings
Related to our handling of strings
S: accepted
The changes in this design / enhancement issue have been accepted and can be implemented
T: bug
Something isn't working
T: enhancement
New feature or request
The MagicPython syntax highlighter (and VS Code, Sublime Text and Atom which all use it) interprets upper (
R"foo"
) and lower case r-strings (r"bar"
) differently. The reason for this is explained in their readme:This is a neat feature, especially in cases with more involved string interpolation which are hard to read and easy to mess up without proper highlighting. As a simplified example:
Note that even GitHub syntax highlighting has this feature. This is what it looks like in VS Code:
Unfortunately, this feature becomes unusable in conjunction with
black
sinceblack
automatically lower cases all r-strings.Describe the solution you'd like
Either add an option to
pyproject.toml
to disable automatic lower casing and/or changeblack
's default behavior to preserve string prefix casing. I prefer the latter.Additional context
This behavior was introduced in #198, apparently without being aware that some syntax highlighters treat the cases differently.
The text was updated successfully, but these errors were encountered: