简体   繁体   中英

Changing the colour of Python docstring params in VS Code

I'm looking to change the colour (or highlight) of params in Python docstrings in VS Code.

I had some look into themes, but I don't quite understand how I could add a custom scope using TextMate.

On the image below, you can see the :param: are the same colour as the string. I'm looking for it to be a different / custom colour.

Might also look into highlighting the return types such as str or dict .

I'd really appreciate any and all help!

代码片段

I dont think it means anything. Maybe its just an update of VS code or you accidently changed you settings.

Since this is inside the docstring there's not much you can do easily. AFAIK themes are based on the language servers definitions in the language. Docstrings are considered a whole "thing" so you can change the whole docstring colour, but not content within the docstring.

You could probably do this if you wrote a VS module, but that's a lot of work for something this minor.

The doc string is colored as a normal string.

Use the extension Highlight to specify which text should have a different color

  "highlight.regexes": {
    "(:(?:param|return))( \\w+)?(:)": {
      "regexFlags": "g",
      "filterLanguageRegex": "python",
      "decorations": [
        { "color": "blue" },
        { "color": "green" },
        { "color": "blue" }
      ]
    }
  }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM