Home > Net >  VS Code syntax highlighting Python f-strings
VS Code syntax highlighting Python f-strings

Time:11-11

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?

CodePudding user response:

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?

CodePudding user response:

You can try changing the theme of VSCode. I usually use the Github theme and I can see proper syntax highlight. Also, make sure all the necessary extensions for python are installed.

Screenshot from VS Code

  • Related