Search code examples
pythonvisual-studio-codesyntax-highlighting

VS Code syntax highlighting Python f-strings


I've been using VS Code for Python for a while now, but after all this time I still haven't figured out how to syntax highlight my f-strings. I've seen screenshots of other people who have them highlighted properly, but mine look like this:

enter image description here

Is this something I have to manually change in my color scheme?


Solution

  • Can it output the correct result? In other words, f-string can work?

    Have you tried to switch the color theme?

    And can you open the Command Palette to execute the command of Developer: Inspect Editor Tokens and Scopes to get this:

    enter image description here

    Can you find the meta.fstring.python like the above picture?

    This could be provided by the Built-in extension of Python Language Basic or MagicPython extension and so on. So could you disable all the python related extensions then only enable the Python and Built-in extension of Python Language Basic to make a try?