Matthijs Kramer
Matthijs Kramer

Reputation: 584

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?

Upvotes: 0

Views: 1912

Answers (2)

Steven-MSFT
Steven-MSFT

Reputation: 8431

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?

Upvotes: 1

Sahana Raguram
Sahana Raguram

Reputation: 24

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

Upvotes: 0

Related Questions