(Python) F strings not highlighting properly #3609
Labels
autoclose
Flag things to future autoclose.
enhancement
An enhancement or new feature
good first issue
Should be easier for first time contributors
help welcome
Could use help from community
language
Describe the issue
When using F strings in python they do not highlight the variables embedded in curly braces differently than the string itself
Which language seems to have the issue?
Python - I am not doing auto detection, I am specifying the language
Are you using
highlight
orhighlightAuto
?Not sure on what this specifically is, my call to highlight is
<script>hljs.highlightAll();</script>
Please let me know if this is not enough information or what specifically you need.
Sample Code to Reproduce
Renders in highlightjs like the screenshot below
Notice the github syntax highlighting does catch the fstring, however the colors being used are hard to easily distinguish.
Expected behavior
Below I have a screenshot from Pycharm and the main key here is it changes the color of the curly braces within the f string to orange and also changes the color of the variable to white. I'm not sure if these should be the color scheme but I do know in my opinion the orange curly braces are very easy to distinguish
Additional context
I do also notice that escaped characters like
\r
or\n
within strings also do not change highlight colors which I think would be very helpful. This is demonstrated in my screenshot in expected behavior.Also It is worth noting that all of my examples show a single quoted f string, but I have tested this behavior is consistent across single or double quoted f strings.
Lastly if it is NOT an f string (missing prepended "f") if there is an embeded variable or curly braces they should NOT be highlighted in order to best indicate that the embeded variable or function will not be processed.
The text was updated successfully, but these errors were encountered: