1

Edit: post (In VS Code 1.79, Python docstrings are colored like comments. How do I return it to the string color?) solved my problem.

Using VSCode, as follows:

Version: 1.79.2
Commit: 695af097c7bd098fbf017ce3ac85e09bbc5dda06
Date: 2023-06-14T08:59:55.818Z
Electron: 22.5.7
Chromium: 108.0.5359.215
Node.js: 16.17.1
V8: 10.8.168.25-electron.0
OS: Linux x64 5.18.10-76051810-generic snap

The change is minor, but incredibly distracting for me: docstrings in Python are showing up the same color as inline # comments. In fact, all triple quoted strings are highlighting as if they're comments when they start the line. There's other weird behavior going on. Here's a screen shot: enter image description here

This started after enabling and then disabling an extension (Pylance) which immediately changed my semantic highlighting. I disabled the extension, set the semantic highlighting in settings to configureByTheme and restarted VSCode. However, this issue persists.

How to I make strings that are read by the interpreter all the same color?

philosofool
  • 773
  • 4
  • 12
  • using a triple quoted strings as the sole expression of the line is equal to a comment, it is useless for the program execution – rioV8 Jun 26 '23 at 21:33
  • @rioV8 Useless is not the same as equivalent to a comment. Docstrings, in any event, are most certainly not comments, affect state, are read as strings by the compiler, and I want semantic highlights that reflect this distinction. – philosofool Jun 27 '23 at 13:25
  • then why is your `f` string orange, it should also be green like the `r` string – rioV8 Jun 27 '23 at 15:32
  • It doesn't really matter. The question is not tagged Python. It's tagged VSCode and your comments are honestly a little troll-like. PEP is clear: docstrings and comments should be formatted differently; triple quotes should not be used for comments. And docstrings do affect the state of the interpreter. My screen shot is not at issue, the behavior of VSCode is. – philosofool Jun 27 '23 at 20:17
  • I have my own PEP – rioV8 Jun 27 '23 at 21:10
  • It is the Python plugin that is the problem not VSC, the TextMate grammar in the plugin decides how it should be colored – rioV8 Jun 27 '23 at 21:12
  • You should point the developers of the plugin to adhere to your PEP usage – rioV8 Jun 27 '23 at 21:13

0 Answers0