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
IDLE doesn't highlight f-strings properly #73257
Comments
IDLE doesn't highlight f-strings like r-strings or u-strings. See the attached screenshot. |
I've attached a patch that colorizes f-strings. The issue is marked as "test needed" which the dev guide says "... reporter should post a script or instructions to let a triager or developer reproduce the issue." Steps to re-create are to open an IDLE window and type in the code
and notice the colorization difference. |
New changeset a48cc85e5706 by Terry Jan Reedy in branch '3.6': |
There are 10 possible f-string prefixes, including combinations with r/R. See While adding these, I noticed that IDLE was coloring now invalid ur prefixes and deleted those. I decided to test by modifying the existing human visual htest. Ammar: thank you for submitting a patch. It happens that I wrote my patch before I saw your submission. If I had seen yours first, I might have given you a chance to finish it. Feel free to try another IDLE issue. |
Not a problem, thank you for the encouragement. |
The regular expression can be simplified using local flags:
+ stringprefix = r"(?i:\br|u|f|fr|rf|b|br|rb)?" |
New changeset 62d3c0336df6 by Terry Jan Reedy in branch '3.6': |
Thank you for the new feature (I presume) and its application. I disliked both writing and reading all the near duplication. I am posting this to python-list as an example of what the new feature is good for. |
Thank you for advertising the new feature. Would you like to improve the |
The doc appears to be carefully accurate, but the second sentence especially is a bit awkward. I will open a new issue. |
bpo-29287 is about syntax highlighting the code within f-strings as code rather than as part of the string. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: